title: Angular proxy path rewrite not working during http get request call?
body: <p>My proxy config not working as it is not redirecting as per rewrite config
  Below is my proxy.config.json</p>
  
  <pre><code>{
      "/sap": {
          "target" : "http://server.domain.com:8002",
          "secure" : false,
          "pathRewrite": {
              "^/sap": ""
          },
          "changeOrigin": true,
          "logLevel": "debug"
      }
  
  }
  </code></pre>
  
  <p>Below is my http call
  <code>this.http.get('/sap/opu/odata/sap/ABC_FD_SRV/ID_GEN_Set?sap-client=010', {headers}).pipe(map((response: any) =&gt; response));</code></p>
  
  <p>Headers used for the http request</p>
  
  <pre><code>var headers = new Headers();
          headers.append('Content-Type', 'application/json');
          headers.append('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT');
          headers.append('Accept', 'application/json ');
          headers.append('X-Requested-With','XMLHttpRequest');
  </code></pre>
  
  <p>Whenever i use <code>ng serve --proxy-config proxy.config.json</code> to start and check in the networks tag instead of <code>http://server.domain.com:8002</code> it redirects to <code>http://localhost:4200</code></p>
  
  <p>i have tried with <code>/sap/*</code> but no use. Can anyone help me to solve this problem i am working out to call odata link to consume the data from the server so i have used <code>changeOrigin: true</code> for cross origin browser problem.</p>