Skip to content

Allow Proxy to be set by environment variables #12420

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
dan-valentine opened this issue May 21, 2022 · 2 comments
Open

Allow Proxy to be set by environment variables #12420

dan-valentine opened this issue May 21, 2022 · 2 comments

Comments

@dan-valentine
Copy link

Is your proposal related to a problem?

Currently, we are using the proxy for create-react-app to proxy requests to a staging server and it works great. We have several environments hosted for development and production (e.g. staging, testing, prod, BSEs, and occasionally long-lived feature branches). If we want to change what server we are proxying to we need to change the field in package.json and remember to revert this change before committing. This frustrates me because I very frequently forget and commit this change.

Describe the solution you'd like

I'd like to be able to set the proxy via environment variables so that it is configurable without having to change tracked files. This would allow us to add environment variables in the shell and not have to change tracked files to change the proxy. I'd like to append || proccess.env.PROXY to line 111 of react-scripts/scripts/start.js

Describe alternatives you've considered

We looked into using 'http-proxy-middleware' to setup a custom proxy that will proxy off environment variables. We are currently not prefixing our endpoints and setting up 'http-proxy-middleware' for a custom proxy to work on environment variables would require some refactoring of the application and how we are integrating with third party software we are using for authorization and processing payments.

Additional context

(Write your answer here.)

@ChrisLane
Copy link

This seems to duplicate the proposal in #9739

@BraianS
Copy link

BraianS commented Feb 1, 2024

Close, no activities since June 1, 2023

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

3 participants