-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Proxy rewrites Origin header to match the target server URL #1212
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Could you please explain how to verify this works? Maybe you could create an example |
See https://github.com/koles/react-scripts-pr-1212 The app POSTs a dummy authentication payload to a web service specified in the "proxy" attribute of the package.json file and displays the result, see https://github.com/koles/react-scripts-pr-1212/blob/master/src/App.js for details. Before applying the patch (using react-scripts 0.8.3): After: |
Could you also add a comment to the source code please? |
Done. |
Thanks! |
Should be fixed in |
…#1212) * Proxy rewrites Origin header to match the target server URL * Added comments on rewriting Origin header by the proxy middleware
…#1212) * Proxy rewrites Origin header to match the target server URL * Added comments on rewriting Origin header by the proxy middleware
The new proxy option introduced in #282 works well for GET requests but many browsers send Origin headers with same-origin POST/PUT/DELETE requests.
This pull request makes the http-proxy-middleware to overwrite the original Origin header (if set) to match the target server URL.