angular / angular/angular-cli

ng serve not working behind reverse proxy basehref/servepath

Đang mở
#27,576 6 bình luận 2 reaction 0 người được giao Xem trên GitHub
area: @angular-devkit/build-angular devkit/build-angular:dev-server freq1: low needs: investigation severity3: broken type: bug/fix
Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
14 giờ 23 phút
Pull request đã merge (30 ngày)
162

Mô tả

### 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/

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện thiết lập đã được báo cáo `ng serve --host 0.0.0.0 --disable-host-check` thông qua URL được chuyển tiếp `/proxy/4200/`. Điều tra cách các tùy chọn `basehref` và `servepath` ảnh hưởng đến Angular node-resource URLs và các chuyển hướng, bao gồm cả trường hợp `/proxy/4200/` bị lặp. Hoàn tất khi máy chủ phát triển được chuyển tiếp tải các tài nguyên đó mà không có đường dẫn sai.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
cli, infrastructure
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.