You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A server can respond to requests from disallowed origins without including Access-Control-Allow-Origin header.
In this case, the browser blocks the request based on the Same-Origin Policy.
Environment:
@whatwg-node/server: 0.9.18
The text was updated successfully, but these errors were encountered:
The idea there to let the browser know the server doesn't accept that origin. Let us know if you have better idea for this behavior. And I also see it is not restricted to return null.
We really need e2e browser tests to confirm browser rejects the request if that header is not present.
Looking at the expressjs/cors code, it seems to be testing the absence of a CORS-related header.
Therefore, I don't think it's a bad idea to not return the CORS-related Header itself instead of null.
I agree that it is safer to add browser E2E testing.
Describe the bug
It seems that MDN states that null should not be used for the value of Access-Control-Allow-Origin, but looking at the implementation below, it seems that null is returned. (See also 7.4. Avoid returning Access-Control-Allow-Origin: "null")
whatwg-node/packages/server/src/plugins/useCors.ts
Lines 57 to 60 in 1e3b128
To Reproduce Steps to reproduce the behavior:
Run the existing test below.
whatwg-node/packages/server/test/useCors.spec.ts
Lines 77 to 88 in 1e3b128
Expected behavior
A server can respond to requests from disallowed origins without including Access-Control-Allow-Origin header.
In this case, the browser blocks the request based on the Same-Origin Policy.
Environment:
@whatwg-node/server
: 0.9.18The text was updated successfully, but these errors were encountered: