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 Access-Control-Allow-Origin before aborting #54

Open
tj opened this issue Apr 24, 2018 · 6 comments
Open

Add Access-Control-Allow-Origin before aborting #54

tj opened this issue Apr 24, 2018 · 6 comments

Comments

@tj
Copy link

tj commented Apr 24, 2018

I plan on sending a PR at some point, just opening this for reference or if someone else wants to grab it.

I think here if we respond with Access-Control-Allow-Origin first it'll lead to nicer browser errors, and require fewer trips to enabling debugging with this middleware to discover what went wrong.

Currently this kind of masks issues with the other fields, so the browser basically just says you don't have access at all. Let me know if that sounds reasonable!

@rs
Copy link
Owner

rs commented Apr 24, 2018

Re-reading the spec, I'm not sure we should stop the processing of the preflight request until there is a parsing error. I might revisit this.

@bithavoc
Copy link

bithavoc commented Jun 10, 2019

When the browser uses <img crossOrigin=Anonymous> there is no pre-flight and this line here halts the execution before isOriginAllowed realizes the desired * origins.

Should I open a separate issue or are we talking about the same thing?

@rs
Copy link
Owner

rs commented Jun 10, 2019

Yes, I think it's a different issue.

@jub0bs
Copy link
Contributor

jub0bs commented Feb 8, 2023

@tj For what it's worth, I mentioned this issue in my latest my blog post.

@jub0bs
Copy link
Contributor

jub0bs commented Oct 29, 2023

Related: whatwg/fetch#1588

@jub0bs
Copy link
Contributor

jub0bs commented Mar 28, 2024

FWIW, I've implemented some debug mode in jub0bs/cors that changes the way the middleware composes responses to preflight requests, and which can be toggled on the fly. Perhaps something to consider for rs/cors.

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