I tried to add the proxy and Rewrite the URL path according to the angular documentation guidelines, but without success, the docs I have followed here: https://angular.io/guide/build#rewrite-the-url-path . What is the correct way to add angualr proxy in an angular multiproject, with angular 17?
1 Answer
Try these few steps to add proxy configuration for angular in a multi-project setup
- in your root project, create a file called - `proxy.config.json
- Add the proxy configuration in the file:
{
"/api": {
"target": "http:locahost:3000",
"secure": false
}
}
This way proxy API request to http:locahost:3000
- Now in the
angular.jsonfile, under the each project, add the proxyConfig settings like
"architect":{
"serve": {
"options": {
"proxyConfig": "proxy.config.json"
}
}
}
I hope this will help you. Cheers 🥂