title: How to solve for: net::ERR_CONNECTION_REFUSED when GET data to React?
body: <p>I'm trying to get this API call to work using axios:</p>
  <pre><code>const getData = () =&gt; {
      Axios.get(&quot;http://localhost:3000/security?select=symbol,company&quot;,
      {headers: {Authorization: 'Bearer 73Ntx3b6SwNXC7ANV3tw4wFfDdKntB26',
                  &quot;Access-Control-Allow-Origin&quot;: &quot;*&quot;,
                  mode: &quot;cors&quot;,               
      }}
      ).then((response) =&gt; {
          console.log(response)
      })
  }
  </code></pre>
  <p>My local API server is up and running, I can make requests using <code>curl</code> and see JSON data. However, the calls do not work when I implement a <code>GET</code> request in my React App.</p>
  <p>I'm a little curious to know why I'm getting these errors:</p>
  <pre><code>Failed to load resource: net::ERR_CONNECTION_REFUSED
  createError.js:16 Uncaught (in promise) Error: Network Error
      at createError (createError.js:16)
      at XMLHttpRequest.handleError (xhr.js:84)
  createError @ createError.js:16
  handleError @ xhr.js:84
  </code></pre>
  <p>Something is blocking the API from showing the data, I assume it's React. In my stack, this connection to <code>localhost:3000</code> API is only used once in the code above, it simply retrieves unique data...</p>
  <p>Any ideas on how to solve?</p>
  <p>EDIT: I have added a picture to show that the port is up and my API is up
  <a href="https://i.stack.imgur.com/4JWG0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4JWG0.png" alt="enter image description here" /></a></p>
  <p>EDIT EDIT:
  So I tested my API live in production to see if it was a backend issue, I can access my API live from a real web-address. No issue there. I guess I tinkered my backend closer to getting the API request to work with React, because now I'm getting an <code>401 unauthorized Request</code> instead of my previous error.</p>
  <p>Here is the config file for my nginx backend for my api url:</p>
  <pre><code>    location /data/ {
        default_type  application/json;
        proxy_hide_header Content-Location;
        add_header Content-Location  /data/$upstream_http_content_location;
        add_header Access-Control-Allow-Origin *;
        proxy_set_header  Connection &quot;&quot;;
        proxy_http_version 1.1;
        proxy_pass http://localhost:3000/;
          }
  }
  </code></pre>
  <p>I have also added new code for my REACT get request above.</p>