title: How do I get my React app to point to my Node/Express API in production. Proxy only works in dev.
body: <p>I'm a bit new to node/react. </p>
  
  <p>I have an API/express node app and in that app I have a react app. The react app has axios.get commands and other API calls. The react app finds the API calls I do and forwards them to the proxy I setup in the package.json of the react app. In dev the proxy looked like this:   "proxy": "<a href="http://localhost:3003/" rel="nofollow noreferrer">http://localhost:3003/</a>" but now that I'm going into production I'm trying to change this proxy to be the URL I'm hosting my node express app in     "proxy": "<a href="http://168.235.83.194:83/" rel="nofollow noreferrer">http://168.235.83.194:83/</a>"  </p>
  
  <p>When I moved my project to production I made port 83 the API node app and I made port 84 the react app (with nginx). For whatever reason though, my react app just doesn't know how to do the API requests to the node app.. I'm getting blank data</p>
  
  <p>After googling I come to realize, the 'proxy' setting only applies to requests made to the development server. Normally in production you have a server that gives the initial page html and also serves api requests. So requests to /api/foo naturally work; you don't need to specify a host.</p>
  
  <p>This is the part I'm trying to figure out. If someone can tell me how to setup my app so that /api/foo  naturally works that would be greatly appreciated.</p>
  
  <p>I took a stab at trying to set that up properly. This is probably a complete failure in terms of an approach but it's late and I'm gonna fall asleep on this problem.. I'm supposed to have nginx handle serving both static html and requests in one statement file? I have this so far but I can be way off here...</p>
  
  <pre><code>server {
    listen 84;
    server_name 168.235.83.194;
  
  
    root /home/el8le/workspace/notes/client/build;
  
    index index.html index.htm;
    location / {
    }
  
    location /api{
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-NginX-Proxy true;
      proxy_pass http://168.235.83.194:83/; //I have nginx hosting my API app on this port. Not even sure if this should be like this?
      proxy_ssl_session_reuse off;
      proxy_set_header Host $http_host;
      proxy_cache_bypass $http_upgrade;
      proxy_redirect off;
    }
  
  }`
  </code></pre>
  
  <p>Also, I'm actually hosting on those ip addresses if you want to get a better sense of where I am at: 
  <a href="http://168.235.83.194:84" rel="nofollow noreferrer">http://168.235.83.194:84</a></p>
  
  <p><a href="http://168.235.83.194:83/customers" rel="nofollow noreferrer">http://168.235.83.194:83/customers</a></p>