При использовании proxy на angular не срабатывает параметр pathRewrite из файла proxy.config.json. Т .е сам процесс proxy работает, нужная страница загружается, но путь url не меняется. Подскажите, в чем может быть причина?
Мой код:
package.json
{
"name": "helloapp",
"version": "1.0.0",
"description": "First Angular 13 Project",
"author": "Mikhail Matveev",
"scripts": {
"ng": "ng",
"build": "ng build",
"start": "ng serve --proxy-config proxy.config.json"
},
"dependencies": {
"@angular/common": "~13.3.1",
"@angular/compiler": "~13.3.1",
"@angular/core": "~13.3.1",
"@angular/forms": "~13.3.1",
"@angular/platform-browser": "~13.3.1",
"@angular/platform-browser-dynamic": "~13.3.1",
"@angular/router": "~13.3.1",
"rxjs": "~7.4.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.3.1",
"@angular/cli": "~13.3.1",
"@angular/compiler-cli": "~13.3.1",
"@types/node": "~14.0.0",
"typescript": "~4.4.4"
}
}
angular.json
{
"version": 1,
"projects": {
"helloapp": {
"projectType": "application",
"root": "",
"sourceRoot": "src",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "../dist/helloapp",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.json",
"aot": true
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "helloapp:build",
"proxyConfig": "proxy.config.json"
}
}
}
}},
"defaultProject": "helloapp"
}
proxy.config.json
{
"/dist/*": {
"target": "https://www.youtube.com/",
"secure": false,
"pathRewrite": {
"^/dist": "https://www.youtube.com/"
},
"logLevel": "debug",
"changeOrigin": true
}
}