CORS policy:Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource #10636

Closed
opened 2025-11-02 09:13:40 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @yyy19961027 on GitHub (Apr 12, 2023).

Description

I set up a gitea environment in Docker, and there was a cross domain issue when Ajax requested the gitea interface in the browser. As shown in the figure below, how should I configure to solve cross domain problems.

docker
config

Screenshots

error

Gitea Version

1.20.0+

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

No response

Browser Version

chrome 111.0.5563.147(正式版本) (64 位)

Originally created by @yyy19961027 on GitHub (Apr 12, 2023). ### Description I set up a gitea environment in Docker, and there was a cross domain issue when Ajax requested the gitea interface in the browser. As shown in the figure below, how should I configure to solve cross domain problems. ![docker](https://user-images.githubusercontent.com/66300848/231336127-4829f37c-e703-4454-b1b5-22e3d429313b.png) ![config](https://user-images.githubusercontent.com/66300848/231336138-08e81656-4663-4b1d-b1fd-f87469b4382e.png) ### Screenshots ![error](https://user-images.githubusercontent.com/66300848/231337510-405e3f82-0fd2-49b5-adfe-e1e25cc6d7c0.png) ### Gitea Version 1.20.0+ ### Can you reproduce the bug on the Gitea demo site? Yes ### Operating System _No response_ ### Browser Version chrome 111.0.5563.147(正式版本) (64 位)
GiteaMirror added the topic/uitype/bug labels 2025-11-02 09:13:40 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Apr 12, 2023):

https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini

image

@wxiaoguang commented on GitHub (Apr 12, 2023): https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini ![image](https://user-images.githubusercontent.com/2114189/231382393-4e6004f5-8021-4b58-a681-d6cf0cbd711d.png)
Author
Owner

@yyy19961027 commented on GitHub (Apr 12, 2023):

I have configured this parameter but it has not taken effect. How should I configure this property specifically.

@yyy19961027 commented on GitHub (Apr 12, 2023): I have configured this parameter but it has not taken effect. How should I configure this property specifically.
Author
Owner

@wxiaoguang commented on GitHub (Apr 12, 2023):

I have configured this parameter

I didn't see so

image
@wxiaoguang commented on GitHub (Apr 12, 2023): > I have configured this parameter I didn't see so <img width="459" alt="image" src="https://user-images.githubusercontent.com/2114189/231404383-1c2fd8c2-2c9a-4c09-aed6-add3ce37a73d.png">
Author
Owner

@yyy19961027 commented on GitHub (Apr 17, 2023):

cors_config

@yyy19961027 commented on GitHub (Apr 17, 2023): ![cors_config](https://user-images.githubusercontent.com/66300848/232373234-e7d42dbe-ef15-466d-838a-5c903b2246a5.png)
Author
Owner

@wxiaoguang commented on GitHub (Apr 17, 2023):

I still didn't see so.

Where is your D?

image

@wxiaoguang commented on GitHub (Apr 17, 2023): I still didn't see so. Where is your `D`? ![image](https://user-images.githubusercontent.com/2114189/232373625-ed91ee29-a218-41be-84a3-276e5323a3b1.png)
Author
Owner

@yyy19961027 commented on GitHub (Apr 17, 2023):

I have configured it to false, but there is still a cross domain issue. Is there anything else that needs to be configured

config_cors

@yyy19961027 commented on GitHub (Apr 17, 2023): I have configured it to false, but there is still a cross domain issue. Is there anything else that needs to be configured ![config_cors](https://user-images.githubusercontent.com/66300848/232406339-12bbbcfb-cb85-4a4d-b5cf-0c241486d4d6.png)
Author
Owner

@wxiaoguang commented on GitHub (Apr 17, 2023):

Are you serious?

I would strongly suggest you to read the materials carefully line by line, before asking ........

  1. Do you want to enable CORS? Then why you set it to false? You should set it to true
  2. Why you wrote "ENABLE"? The document says "ENABLED", I have highlighted that line not only once.
@wxiaoguang commented on GitHub (Apr 17, 2023): Are you serious? I would strongly suggest you to read the materials carefully line by line, before asking ........ 1. Do you want to enable CORS? Then why you set it to false? You should set it to true 2. Why you wrote "ENABLE"? The document says "ENABLED", I have highlighted that line not only once.
Author
Owner

@yyy19961027 commented on GitHub (Apr 17, 2023):

Sorry, I didn't see your description at the beginning. Now that I have configured the correct parameters as you mentioned, there is still a cross domain issue. May I ask if you are Chinese? If so, we will communicate in Chinese.
config_cors

@yyy19961027 commented on GitHub (Apr 17, 2023): Sorry, I didn't see your description at the beginning. Now that I have configured the correct parameters as you mentioned, there is still a cross domain issue. May I ask if you are Chinese? If so, we will communicate in Chinese. ![config_cors](https://user-images.githubusercontent.com/66300848/232409131-b10a983a-8bee-423a-99a2-5a1b40104194.png)
Author
Owner

@wolfogre commented on GitHub (Apr 17, 2023):

@yyy19961027

Maybe you can join our QQ group and ask this question in the group, which is full of Chinese. You can find the entrance in the menu of https://gitea.io/en-us/

I don't think this is a bug, so I'm going to close this issue.

要不你加 QQ 群在群里问吧,群里都是中国人,加群的入口在 https://gitea.io/en-us/ 顶部菜单里。我先把这个 issue 关掉了,这不是 Gitea 的 bug。

@wolfogre commented on GitHub (Apr 17, 2023): @yyy19961027 Maybe you can join our QQ group and ask this question in the group, which is full of Chinese. You can find the entrance in the menu of https://gitea.io/en-us/ I don't think this is a bug, so I'm going to close this issue. > 要不你加 QQ 群在群里问吧,群里都是中国人,加群的入口在 https://gitea.io/en-us/ 顶部菜单里。我先把这个 issue 关掉了,这不是 Gitea 的 bug。
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10636