====== Proxy to Back-end For Development ======
- Create a file call ''proxy.conf.json'' in the root directory of your project.
- Fill the config in ''proxy.conf.json'':
{
"/BACKEND_SERVER_URL/*": {
"target": "http://localhost:8080/BACKEND_SERVER_URL/",
"secure": false,
"logLevel": "debug",
"changeOrigin": false,
"pathRewrite": {
"^/BACKEND_SERVER_URL": ""
}
, "headers": {"ipaddress":"127.0.0.1"}
}
}
- Start your back-end server. Assume your back-end server url is ''http://localhost:8080/BACKEND_SERVER_URL/''
- Start the front-end with: ng s --base-href /YOUR_BASE_URL/ --deploy-url /BACKEND_SERVER_URL/ --proxy-config proxy.conf.json
- Now your front-end http request will automatically redirect by angular from port 4200 to 8080 with the relative back-end url.