Skip to content

Allow setting the proxy through an environment variable #9739

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

Open
wozzo opened this issue Oct 2, 2020 · 9 comments
Open

Allow setting the proxy through an environment variable #9739

wozzo opened this issue Oct 2, 2020 · 9 comments

Comments

@wozzo
Copy link

wozzo commented Oct 2, 2020

Is your proposal related to a problem?

We have multiple tenants and the tenant is specified as part of the url that we proxy to
e.g. The bindings we use locally are of the form tenant1.localhost, tenant2.localhost
Currently we manually change the value of the proxy setting in the package.json file depending on which tenant we're testing against. This then means that that change often gets committed and leads to unnecessary conflicts as other devs have done the same.

Describe the solution you'd like

I suggest allowing the proxy setting to be controlled by either the package.json or an environment variable setting, with the environment variable winning if both are set.
This would mean that a default value could be stored in the package.json, for the first time a dev environment is set up, but can be easily overridden without the possibilty for committing changes that lead to conflicts or affect other dev environments.

Describe alternatives you've considered

I tried configuring the proxy manually but we don't have a simple set of rules that can be applied to determine if the request should be proxied, so I was unsuccessful, and the existing react scripts one works perfectly for our needs apart from this one issue.

Additional context

I think that the proxy setting is similar to other advanced configuration options set using environment variables in that they are often specific to development environments and so should be configurable in the same way.

@brainwipe
Copy link

Agreed! The proxy, like the host, port etc isn't a concern of the package.json. It should live in environment variables.

@wozzo
Copy link
Author

wozzo commented Dec 7, 2020

The PR for this has been completed for some time.
Is something else needed to get the issue triaged and the code reviewed?

@ChrisLane
Copy link

I just came looking to find if this feature exists already. Having to change the proxy in package.json, a VCS tracked file is not ideal for temporary adjustments that I don't want to commit. Making changes in .env.development.local would be much preferred!

Hopefully the PR can be merged soon!

@Matzz
Copy link

Matzz commented Mar 12, 2021

There are plenty of interpolation librarires (https://www.npmjs.com/search?q=keywords:string%20interpolation)
I think one of them could be used here

@Subterrane
Copy link

#11225

@wozzo
Copy link
Author

wozzo commented Aug 30, 2021

#11225

Yeah I've had this PR up for nearly a year. Not sure anyone is listening 😔

@Subterrane
Copy link

I didn't even see yours, derp. Yeah, same solution, but you went the extra mile and updated documentation, too!

@Subterrane
Copy link

I got tired of waiting and used https://www.npmjs.com/package/patch-package to fix it myself.

@wozzo
Copy link
Author

wozzo commented Oct 20, 2021

Don't blame you. We've engineered out our dependency on the proxy anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants