angular proxy config file for angular 2 code example
Example: angular run with proxy
# Create Proxy file proxy.conf.json in root folder with the below content
{
"/api/*": {
"target": "http://localhost:8080",
"secure": false,
"logLevel": "debug",
"changeOrigin": true,
"pathRewrite": { "^/api": "" } // needed if you want to change api to empty when calling your backend service
}
}
# when you run use
ng serve --proxy-config proxy.conf.json