This repository was archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 478
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
Only first rule is taken into account in proxy configuration #2411
Copy link
Copy link
Closed
Description
🐞 Bug report
What modules are related to this issue?
- aspnetcore-engine
- builders
- common
- express-engine
- hapi-engine
Is this a regression?
I don't know.
Description
When you have several rules in your proxy configuration file only the first one is taken, following are ignored.
🔬 Minimal Reproduction
- Create a
proxy.conf.jsonfile with 2 rules
{
"/api1": {
"target": "http://www.api1.com",
"pathRewrite": {
"^/api1": "/"
},
"secure": false
},
"/api2": {
"target": "http://www.api2.com",
"pathRewrite": {
"^/api2": "/"
},
"secure": false
}
}- Add the proxyConfig option in
angular.json
"serve-ssr": {
"builder": "@nguniversal/builders:ssr-dev-server",
...
"options": {
"proxyConfig": "proxy.conf.json"
}
},- Run the Angular Universal Live Development Server
Only the first rule is taken into account:
Compiled successfully.
[HPM] Proxy created: /api1 -> http://www.api1.com
[HPM] Proxy rewrite rule created: "^/api1" ~> "/"
** Angular Universal Live Development Server is listening on http://localhost:4200, open your browser on http://localhost:4200 **🌍 Your Environment
Angular CLI: 12.2.4
Node: 14.15.0
Package Manager: yarn 1.22.11
OS: darwin x64
Angular: 12.2.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1202.8
@angular-devkit/build-angular 12.2.4
@angular-devkit/core 12.2.4
@angular-devkit/schematics 12.2.4
@angular/cdk 12.2.6
@angular/fire 7.0.4
@angular/flex-layout 12.0.0-beta.35
@nguniversal/builders 12.1.2
@nguniversal/express-engine 12.1.2
@schematics/angular 12.2.4
rxjs 6.6.7
typescript 4.3.5