I have added the REACT_AP" /> I have added the REACT_AP" /> I have added the REACT_AP"/>

React App environment variable is undefined hosted on IIS manager

1.1k Views Asked by At
<configuration>
  <appSettings>
      <add key="REACT_APP_SERVER_URL" value="http://hostname.api" />
  </appSettings>
</configuration>

I have added the REACT_APP_SERVER_URL env key in the web.config file and the React App is hosted on the IIS manager. I did a console.log(process.env.REACT_APP_SERVER_URL) in React to read the value of this key but I always get back the value of undefined.

I have also hosted a Node Express server on the same IIS manager instance and the environment variables works fine there. I am not sure if this is a React issue or IIS manager issue, can someone assist me? Thanks.

0

There are 0 best solutions below