title: acces to my api express.js work locally but do not work remotly on win-server 2016 what is the problem?
body: <p>I have a react.js application that is hosted on win server 2016 IIS on port 80 and is accessible locally on the server and remotely.
  I have an express.js application that listens on port 4000 that works locally but remotely my react app doesn't work.My express api is launched with PM2 and I have also tried with IISnode. the result is the same.
  Failed to load resource: net::ERR_CONNECTION_REFUSED
  localhost:4000/anomaliesafCount:1
  locally everything works.</p>
  <pre><code>const port = process.env.PORT || 4000;
  
  var cors = require('cors')
  
  app.use(cors()) // Use this after the variable declaration
  
  
  app.use(bodyParser.json())
  app.use(
    bodyParser.urlencoded({
      extended: true,
    })
  )
  
  app.use(function(req, res, next) {
    res.header(&quot;Access-Control-Allow-Origin&quot; , &quot;http://10.70.191.24&quot; ); // update to match the domain you will make the request from
    res.header(&quot;Access-Control-Allow-Headers&quot;, &quot;*&quot;);
    res.header(&quot;Access-Control-Allow-Methods&quot;, &quot;PUT, POST, GET, DELETE, PATCH, OPTIONS&quot; ); 
    res.header(&quot;Access-Control-Max-Age&quot; ,  1728000);
    res.header(&quot;Content-Length&quot; , &quot;0&quot;);
    next();
  });
  
   
  app.get('/', (request, response) =&gt; {
      response.json({ info: 'Node.js, Express, and Postgres API  ' })
    })
    
    
  app.listen(port, () =&gt; {
  console.log(`App running on port ${port}.`)
   })
  </code></pre>