Uh oh!
There was an error while loading. Please reload this page.
Proxy rewrites Origin header to match the target server URL - #1212
Conversation
facebook-github-bot
commented
Dec 8, 2016
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. |
facebook-github-bot
commented
Dec 8, 2016
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
gaearon
commented
Dec 9, 2016
Could you please explain how to verify this works? Maybe you could create an example |
koles
commented
Dec 9, 2016
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: |
gaearon
commented
Dec 9, 2016
Could you also add a comment to the source code please? |
koles
commented
Dec 9, 2016
Done. |
gaearon
commented
Dec 11, 2016
Thanks! |
gaearon
commented
Dec 11, 2016
Should be fixed in |
* Proxy rewrites Origin header to match the target server URL * Added comments on rewriting Origin header by the proxy middleware
* 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.