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

consider setting cors.allow_any_origin = true when run in --dev mode #1898

Closed
EverlastingBugstopper opened this issue Sep 27, 2022 · 2 comments

Comments

@EverlastingBugstopper
Copy link
Contributor

when running the router in --dev mode, whether through rover dev or otherwise, i may like to point a local front end application at the local router endpoint. unfortunately, this is not possible with the default --dev configuration - requests can only be made from embedded sandbox.

since we recommend folks not to run --dev in production environments, i think it should be OK to set cors.allow_any_origin = true when running in --dev mode to enable these development workflows.

@abernix
Copy link
Member

abernix commented Nov 18, 2022

This is continuously a challenging issue. The challenge with using * for origin is that it is fundamentally incompatible with the access-control-allow-credentials flag which I believe becomes necessary the second you use an authorization header.

And still, even just allowing * puts your Router (which is a proxy to the internet and production environments in some cases!) in the position of being subject to malicious plugins/tools running on the local computer that might be probing for insecure localhost or specifically engineered to exploit a known endpoint/configuration.

Ultimately, users need to understand that the CORS domain needs to be set. However, we think we can help them:

Proposal:

When running in --dev mode, if the Router — after evaluating the origin: header sent by the browser is choosing to deny a particular request, it can log a helpful message to the console instructing how to make the change.


I know this isn't compatible with Rover's starting of the Router at this second (since Rover doesn't allow configuration), but this will at least make --dev a bit easier.

Thoughts?

@EverlastingBugstopper
Copy link
Contributor Author

EverlastingBugstopper commented Dec 9, 2022

closing this in favor of apollographql/rover#1373

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

2 participants