angular / angular/angular-cli

ng serve not working behind reverse proxy basehref/servepath

未關閉
#27,576 6 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視
area: @angular-devkit/build-angular devkit/build-angular:dev-server freq1: low needs: investigation severity3: broken type: bug/fix
主要語言
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

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。