ng serve not working behind reverse proxy basehref/servepath
- 主要语言
- TypeScript
- 星标
- 27k
- 派生
- 11.8k
- 平均合并
- 14 小时 23 分钟
- 30 天内合并 PR
- 162
描述
### Command
serve
### Is this a regression?
- [X] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
before vite
### Description
I provide remote training for Angular using VSCode in the browser.
It is no longer possible to use the vscode port forwarding to access the ng dev server as basehref and servepath combinations to not yield the correct result when @angular node resources are to be loaded. It works for all other assets/files in the project.
### Minimal Reproduction
Use code-server oder vscode server access through web browser.
ng new
ng serve --host 0.0.0.0 --disable-host-check
Open the forwarded port, URL becomes f.e.
https://student01.remote-training.de/proxy/4200/
### Exception or Error
_No response_
### Your Environment
```text
Angular CLI: 17.3.6
Node: 20.12.2
Package Manager: npm 10.5.0
OS: linux x64
Angular: 17.3.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1703.6
@angular-devkit/build-angular 17.3.6
@angular-devkit/core 17.3.6
@angular-devkit/schematics 17.3.6
@angular/cli 17.3.6
@schematics/angular 17.3.6
rxjs 7.8.1
typescript 5.4.5
zone.js 0.14.5
```
### Anything else relevant?
I tried various configuration combinations using prebundle, basehref and servepath only to experience worse problems like beeing redirected to https://student01.remote-training.de/proxy/4200/proxy/4200/
贡献指南
调研方向
首先,通过转发的 `/proxy/4200/` URL 复现报告中的 `ng serve --host 0.0.0.0 --disable-host-check` 配置。调查 `basehref` 和 `servepath` 选项如何影响 Angular node-resource URLs 和重定向,包括 `/proxy/4200/` 重复的情况。当转发的开发服务器能够在路径不错误的情况下加载这些资源时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- cli, infrastructure
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100