title: net::ERR_CONNECTION_REFUSED with http post in angular2
body: <p>I am getting the following error with POST request:</p>
  
  <blockquote>
    <p>POST <a href="http://127.0.0.1:port/v1/route2" rel="nofollow noreferrer">http://127.0.0.1:port/v1/route2</a> net::ERR_CONNECTION_REFUSED</p>
  </blockquote>
  
  <p>GET request is working perfectly fine. What could be the possible reason for the failure of POST? Is there any mistake in the <code>testPost</code>?<br>
  Here is the part of angular service:</p>
  
  <pre><code>@Injectable()
  export class SampleService {
      private _getUrl: string = 'http://&lt;server-ip&gt;/v1/route1';
      private _postUrl: string = 'http://127.0.0.1:&lt;port&gt;/v1/route2';
      constructor(private _http: Http) {}
      testGet() {
          return this._http.get(this._getUrl).map((response: Response) =&gt; response.json());
  }
      testPost() {
          const headers = new Headers();
          headers.append('Content-Type', 'application/json; charset=utf-8');
          this._http.post(this._postUrl, JSON.stringify({'key1': 'value1', 'key2': 'value2'}), headers).subscribe(() =&gt; {}, err =&gt; console.error(err));
      }
  }
  </code></pre>