My proxy config not working as it is not redirecting as per rewrite config Below is my proxy.config.json
{
"/sap": {
"target" : "http://server.domain.com:8002",
"secure" : false,
"pathRewrite": {
"^/sap": ""
},
"changeOrigin": true,
"logLevel": "debug"
}
}
Below is my http call
this.http.get('/sap/opu/odata/sap/ABC_FD_SRV/ID_GEN_Set?sap-client=010', {headers}).pipe(map((response: any) => response));
Headers used for the http request
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');
Whenever i use ng serve --proxy-config proxy.config.json to start and check in the networks tag instead of http://server.domain.com:8002 it redirects to http://localhost:4200
i have tried with /sap/* 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 changeOrigin: true for cross origin browser problem.