DEV Community 👩‍💻👨‍💻

Discussion on: How to deploy React Application on IIS Server

Collapse
 
sumitkharche profile image
Sumit Kharche Author • Edited on

The proxy feature isn't meant for production. Proxy is most suitable in the Development environment but when you deploy your app with prod mode on a web server then you need to do it in different ways.
Few links for your references:
create-react-app.dev/docs/proxying...
github.com/facebookincubator/creat...

One way you can do it by using the environment variables.
create-react-app.dev/docs/adding-c...

so for development create file .env.development outside of src folder and add your API URL like:

REACT_APP_API_BASE_URL='<your local api url>'

For Production create file .env outside of src folder & add your Prod api base url like above.

once you configure your API URLs you can simply use it in your as App as below:

process.env.REACT_APP_API_BASE_URL

I hope this solves your problem. Please let me know if any queries.

Collapse
 
jadhavaa1994 profile image
JADHAVAA1994

I have created a web app with frontend React and nodejs backend.
I want to host web app on windows IIS web server.
In IIS Prdouction env.Application working fine but react app failes to connect with backed nodejs.
In vs code development environment it's working fine but on production iis server not working.
How do I resolve this issue?
Showing Error
Request Method: POST
Status Code: 404 Not Found