Skip to content

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

Open
@osdiab

Description

@osdiab

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions