-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CORS for 'GET' attachment or assets are not working #17098
Comments
Ad 1: Are you talking about API routes? A specific one or all? For frontend routes I'm pretty sure this is on purpose as a hardening measure. |
Not frontend routes. Some facts below:
Gitlab API works fine in the same scenes ablove. How to replay it ?
Thank you for reply, |
The CORS code has been unmaintained for long time, and the behavior is not correct. This PR tries to improve it. The key point is written as comment in code. And add more tests. Fix go-gitea#28515 Fix go-gitea#27642 Fix go-gitea#17098 # Conflicts: # tests/integration/cors_test.go
The CORS code has been unmaintained for long time, and the behavior is not correct. This PR tries to improve it. The key point is written as comment in code. And add more tests. Fix go-gitea#28515 Fix go-gitea#27642 Fix go-gitea#17098
The CORS code has been unmaintained for long time, and the behavior is not correct. This PR tries to improve it. The key point is written as comment in code. And add more tests. Fix go-gitea#28515 Fix go-gitea#27642 Fix go-gitea#17098
The CORS code has been unmaintained for long time, and the behavior is not correct. This PR tries to improve it. The key point is written as comment in code. And add more tests. Fix go-gitea#28515 Fix go-gitea#27642 Fix go-gitea#17098
Gitea Version
1.15.2
Operating System
Windows
How are you running Gitea?
Localhost
Can you reproduce the bug on the Gitea demo site?
Yes
Description
CORS both for 'POST/PATCH' API and for 'GET' attachment or assets are not working
I am building a PWA and using REST API get access to issues and comments of self hosted Gitea. There are servial issues about CORS:
CORS works only for 'GET' method. And never set ’Access-Control-Allowed-Origin: *‘ for 'POST', 'PATCH' etc.
// after using a chrome extension 'Corss Domain', it adds the response headers ’Access-Control-Allowed-Origin: *‘ for 'POST', 'PATCH', and my PWA works.
CORS works only for REST API not for ASSETS.
As we known, CORS http method call after an 'OPTIONS' prelight request. However, 'OPTIONS’ method was not allowed for attachement assets request. It just return '405 method not allowed' while I access to the resource CORS way, using the right token.
// I have not found a Chrome extension to fix the reponse code for options access to assets yet.
// so the issue blocked.
Gitlab API provides the right response code and headers about CORS API access from different domains.
Hoping Gitea can improve the CORS implements and configration.
Screenshots
The text was updated successfully, but these errors were encountered: