0

To set up proxy in development mode we can add proxy to package.json like that:

"proxy": "http://localhost:4000"

However, this method doesn't work in the production build for CRA-based apps since it is development-mode-only feature.

What are the ways to set up a proxy when API and client bundle are hosted on different domains and there is no access to configure the server which serves the client bundle(e.g. the client bundle is served on netlify and the API on heroku)?

The similar questions were asked in the comment section on several topics - 1 and 2 but there were no answers.

Dmitriif
  • 2,020
  • 9
  • 20
  • I hope you are placing the accurate URL instead of `localhost`. – Umair Riaz Jan 03 '22 at 08:46
  • It doesn't matter what is placed in the "proxy" key-value pair inside pacjage.json in production build since the proxy feature works only in development mode – Dmitriif Jan 03 '22 at 08:53

0 Answers0