angular / angular/angular-cli

ng serve not working behind reverse proxy basehref/servepath

オープン
#27,576 コメント 6 件 リアクション 2 件 担当者 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分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。