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

[Notice] Preflight with no origin will return OPTIONS 404 #86

Open
fghpdf opened this issue Apr 9, 2022 · 1 comment
Open

[Notice] Preflight with no origin will return OPTIONS 404 #86

fghpdf opened this issue Apr 9, 2022 · 1 comment

Comments

@fghpdf
Copy link

fghpdf commented Apr 9, 2022

Now you can see there is no [Origin] in my OPTIONS Request
image

And At Here

cors/config.go

Lines 58 to 62 in 5f50d4f

origin := c.Request.Header.Get("Origin")
if len(origin) == 0 {
// request is not a CORS request
return
}

The code will return and do nothing. Will Not Return Headers.

So If you not define OPTIONS Router, you will get 404 immediately.

@jub0bs
Copy link

jub0bs commented May 3, 2023

I'm not sure what behaviour you're expecting but, by definition, a preflight request always contains an Origin header.

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

2 participants