Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

should preflight request return 204 instead of 404 when origin not match? #65

Open
atian25 opened this issue Oct 11, 2019 · 0 comments
Open

Comments

@atian25
Copy link

atian25 commented Oct 11, 2019

Background

If a browser sends an OPTIONS request, but origin it not match, now koajs/cors will return 404 status code, due to https://github.com/koajs/cors/blob/master/index.js#L60

then the browser will warn 404, some user will confuse if they need to register an OPTION router.

Discuss

should it return 204 here?

I don't find any clear description at SPEC:

https://www.w3.org/TR/cors 7.1.5 Cross-Origin Request with Preflight

and according to spec below, OPTIONS should never return 404.

and Express will return 204, https://github.com/expressjs/cors/blob/master/lib/index.js#L178

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

No branches or pull requests

1 participant