-
Notifications
You must be signed in to change notification settings - Fork 1
[73] modify cors to allow including credentials #74
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
[73] modify cors to allow including credentials #74
Conversation
explicitly define allowed methods and origins
jakubmanczak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like it being mandatory for local development, as most of the time you'd just specify 'localhost' anyway; this, or request origin reflection, should happen in dev builds by default.
| let layer = CorsLayer::new() | ||
| .allow_origin(frontend_origin.parse::<HeaderValue>().unwrap()) | ||
| .allow_methods([Method::GET, Method::POST, Method::DELETE, Method::PATCH]) | ||
| .allow_headers([CONTENT_TYPE]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, does it require us to specify allowed headers? Please tell me it doesn't. And let's not do that if we can avoid it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, it does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you tell me exactly why? How does this need manifest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying to make requests at browser level, errors are returned: this one and others relating to it. This forced me to define allowed origins, methods and headers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing this turns out to be true; I meant specifically Allowed-Headers, since the other ones are commonly seen and all. This is so extremely dumb. But yes, I concede. This works.
jakubmanczak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still have a think about that CORS origin reflection, but this will have to do.
Resolves #73