-
-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Adding custom headers to "react-scripts start" #4861
Comments
If you just want to be able to use cors during dev, you can simply add a chrome extension for that. There are plenty to choose from. https://chrome.google.com/webstore/search/cors?_category=extensions |
Is there a reason CORS could not just be allowed for every origin in the dev server? |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. |
The cors extensions don't work for us locally, probably due to the same domain but different ports? |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
This is really helpful when building apps that are meant to be embedded in and interact with another app. For example, the Invision Trello Power-Up used "npm eject" to be able to add the CORS headers that Trello Power-Ups are required to have.
I'm working on a solution in my own fork of react-scripts to avoid ejecting, as suggested in the Guide, but I wanted to get feedback on whether this is a feature that could be merged upstreamed and what it would need to look like.
Here's what I'm thinking: add a "headers" key to package.json, which contains an object of custom headers as passed to the Webpack dev server:
Other alternatives include adding a
"cors": true
or"cors": "*"
option.The text was updated successfully, but these errors were encountered: