title: what url should the client call to a server in the same domain
body: <p>I have a server and a client on the same domain.</p>
  
  <p>Client:
  <a href="http://localhost:8080/ST/html/pages/gasolina/" rel="nofollow">http://localhost:8080/ST/html/pages/gasolina/</a></p>
  
  <pre><code>    return this.http.get(this.dataUrl)
        .toPromise()
        .then(response =&gt; {
          this.cachedConfigs = response.json() as CountryConfig[];
          return action(this.cachedConfigs);
        });
  </code></pre>
  
  <p>Server:
  <a href="http://localhost:8080/ST/Gas/Config" rel="nofollow">http://localhost:8080/ST/Gas/Config</a></p>
  
  <p>If i want to the client to call the server,</p>
  
  <p>What url should I call?</p>
  
  <p>If I call this url:</p>
  
  <p><code>'/ST/Gas/Config'</code></p>
  
  <p>I get <code>java.net.ConnectException: Connection refused &lt;= Connection refused</code> error</p>
  
  <p>If I call this url:</p>
  
  <p><code>'http://locahost:8080/ST/Gas/Config'</code></p>
  
  <p>I get</p>
  
  <p><code>XMLHttpRequest cannot load http://locahost:8080/ST/Gas/Config. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.</code></p>