Skip to content
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

Add OPTIONS to allowed methods in default config #50

Open
lukyth opened this issue Mar 1, 2019 · 3 comments
Open

Add OPTIONS to allowed methods in default config #50

lukyth opened this issue Mar 1, 2019 · 3 comments

Comments

@lukyth
Copy link

lukyth commented Mar 1, 2019

According to https://github.com/gin-contrib/cors/blob/master/cors.go#L151, OPTIONS aren't allowed by default. Should it be allowed?

When performing certain types of cross-domain Ajax requests, modern browsers that support CORS will insert an extra preflight request to determine whether they have permission to perform the action. The preflight request is using the OPTIONS method.

@vzool
Copy link

vzool commented May 21, 2019

Same issue here, it should be catch all OPTIONS globally and returns a proper response.

@zaynetro
Copy link

OPTIONS is a special request and is handled separately: https://github.com/gin-contrib/cors/blob/master/config.go#L76

@jub0bs
Copy link

jub0bs commented Oct 25, 2022

Mistaking an OPTIONS request as a preflight request is a recurring problem in CORS middleware. However, not all OPTIONS requests are preflight requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants