2

I have a CRA development project created on remote component that i run locally using VSCODE

This project production deployment is served using NGINX to access the build dir. This server Requires HTTPS.

When I run the project locally and try to make calls to the express backend I get an ERR_EMPTY_RESPONSE error

I have cors setup:

app.use(
cors({
    origin: ["http://localhost:{port}"],
    credentials: "true",
})

);

in react package json:

  "proxy": "{ACTUAL_DOMAIN_NAME},

and axsios:

axios.defaults.withCredentials = true

Is there a way to run the development instance on the remote server so it will be responsive to code changes? (hot reloading)

Isaac Cohen
  • 158
  • 1
  • 13

1 Answers1

1

you can use a Proxy - to redirect all your request to a specific server (one or more) this is good only for development

https://create-react-app.dev/docs/proxying-api-requests-in-development/

when you use proxy - cors is not a issue

yanai edri
  • 359
  • 2
  • 4