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

noCors middleware does not work if send cookies from other origin #63

Closed
RiceWithMeat opened this issue May 24, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@RiceWithMeat
Copy link
Collaborator

RiceWithMeat commented May 24, 2023

If try to send cookies from other origin (other port on localhost for example) CORS error occurs.
image
This happens because we use * for requests with credentials, but wildcard for such requests is not allowed. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers

@debabin
Copy link
Member

debabin commented Nov 20, 2024

The team was wondering whether to automate Cors when users send a request with credentials using fetch or xhr

We decided after all that this is the responsibility of the user. Users must resolve security issues independently

fetch('http://localhost:31299/users', {method: 'POST', credentials: 'include', headers: { test: 'test' } })

We could substitute all the necessary origin and headers ourselves to solve this problem, but there is a chance that the mock is used not only for the dev environment

If you need credentials in your request, you should fill cors data in config or use server to server channel

@debabin debabin closed this as completed Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants