title: Angular2 web pack proxy configuration
body: <p>Since angular-cli is maturing nicely, I decided to port an Angular2 app to take advantage of angular-cli awesomeness. However proxying to an external remote service running on localhost is taking on a wild trip.</p>
  
  <p>Version Info</p>
  
  <pre><code>ng --version
  angular-cli: 1.0.0-beta.19-3
  node: 7.0.0
  os: darwin x64
  </code></pre>
  
  <p>So from angular app, I would like to proxy all <code>/service/**</code> requests to a RESTful api running on nginx @ <code>http://localhost.api.co.za</code></p>
  
  <p><em>Configurations</em></p>
  
  <pre><code>{
    "/service/*" : {
      "target":"http://localhost.api.co.za/",
      "secure": false,
      "changeOrigin": true,
      "pathRewrite": {
      "^/service": ""
      }
    }
  }
  </code></pre>
  
  <p>nginx access.log prints out a <strong>404</strong> <code>POST /api/v1/testing HTTP/1.1" 404 169 "http://localhost:4200/contact"</code> </p>
  
  <p>Tried all the tricks in this port <a href="https://github.com/webpack/webpack-dev-server/issues/458" rel="nofollow noreferrer">webpack-dev-server proxy dosen't work</a></p>