Skip to content

proxy changeOrigin set to true by default #4302

Closed

Description

@SavePointSam

Is this a bug report?

No

Expected Behavior

When configuring the proxy setting in package.json to a string, requests to should not changeOrigin as false is the default setting in node-http-proxy.

Actual Behavior

changeOrigin is enabled by default.

Potential Solutions

  1. Disable changeOrigin by default for simple string proxy configuration.
  2. Add documentation to the User Guide to alert users that this will occur and what it means.

Activity

  1. Timer commented on Sep 26, 2018

    @Timer
    Contributor

    Can you explain this more? What behavior does this turn on? Why is it bad?

  2. SavePointSam commented on Sep 26, 2018

    @SavePointSam
    Author

    I have a file server running tus-node-server sitting behind my application server that I proxy to for file uploads and downloads. Tus by default reads the origin header to dynamically generate a location to ask the client to send requests to going forward.

    I had to spend some time debugging the problem I was having where my file server was sending back locations that were relative to my application server and not the client. While the fix is simple enough, it was not documented, nor is it the default behavior for the packages running the proxy under the hood.

    I'm not sure why a system would want to change the default behavior seeing as this is a proxy. Wouldn't all consumers of the proxied request want to know the original origin by default? I don't know what value there is in masking it.

    Ultimately, I would like to either have the CRA default match the underlying tooling defaults or at the very least have documentation helping advanced proxy users know that CRA alters the default behavior without them having to read the CRA source code.

  3. SavePointSam commented on Sep 26, 2018

    @SavePointSam
    Author

    Looks like this is no longer an issue as it appears the proxy key in package.json has been removed in v2 in favor of the more flexible proxySetup.js. If that is the case, this issue is no longer valid. Thanks!

  4. gaearon commented on Sep 27, 2018

    @gaearon
    Contributor

    There's still support for a "simple" proxy key, but indeed advanced configuration is now fully flexible.

  5. SavePointSam commented on Sep 27, 2018

    @SavePointSam
    Author

    It may be worthwhile to note this in the guide then. 🤷‍♂️

  6. gaearon commented on Sep 27, 2018

    @gaearon
    Contributor

    Added to #5127.

  7. gaearon commented on Sep 27, 2018

    @gaearon
    Contributor

    You're also welcome to PR :-)

  8. SavePointSam commented on Sep 27, 2018

    @SavePointSam
    Author

    I probably will! haha

  9. locked and limited conversation to collaborators on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions