Skip to content
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

Docs for how to use the dev proxying feature with the local network feature, if possible #8682

Comments

@osdiab
Copy link

osdiab commented Mar 21, 2020

Is your proposal related to a problem?

For my web app I use http-proxy-middleware as mentioned in the CRA docs in a setupProxy.js file to proxy API requests to a locally running API server like so:

  app.use(proxy("/api", { target: "http://localhost:8000/" }));

However when running create-react-app it also offers that you can access your site on your local network via an IP address, for example to test the experience on a mobile device. This feature doesn't seem to be compatible with the proxying approach as I'm using above, which I think is because that localhost URL isn't being rewritten to the IP address either (and i'm not sure if a different port will be forwarded as well).

Spectrum thread for my use case here.

Describe the solution you'd like

If this is possible I would love for the proxying docs to explain how to make these two features work together in harmony.

Describe alternatives you've considered

I tried messing around with settings passed to http-proxy-middleware, but I'm having trouble coming up with something that works.

Additional context

Thanks for the great project and hope this helps in making it even greater!

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