Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

ability to rewrite location and cookies on v1-toolkit proxies

Đang mở
#4,770 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với cấu hình proxy trong ionic.config.json và xem xét fork v1-toolkit-proxy-rewrite-location-and-cookie được liên kết. Kiểm tra cách CLI sử dụng http-proxy-middleware và xác định xem việc viết lại cookie-domain, viết lại Location, gỡ lỗi và các đích proxy động dựa trên đường dẫn có thể được xác định phạm vi cùng nhau hay không. Công việc được xem là hoàn tất khi có phạm vi tính năng đã thống nhất và một triển khai được chấp nhận cho các hành vi proxy đã chọn.

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

Mô tả

triage

Our app runs ionic v1 and until now we used Chrome with some security settings turned off when testing our app in order to avoid most cross-origin issues like CORS and cookie samesite over HTTP when we call our REST API.

Recently Chrome 94 dropped support of some flags we really need like SameSiteByDefaultCookies or CookiesWithoutSameSiteMustBeSecure.

So we decided to use ionic's proxies feature which is configurable in ionic.config.json.

Unfortunately we went through some impediments:

  1. one of our api does some redirection (like http://testserver 302-redirects to http://testserver/otherapi)
  2. on production servers, some cookies have a domain set, which of course won't match the local test server entry point (usually http://localhost:8100)
  3. we have a lot of different test servers, this would require a lot of entries in the proxies array.

To cover cases 1) and 2), we implemented new settings for the proxy (development has started on a fork):

  • cookieDomainRewrite: { [domain: string]: string }; turns on rewriting cookie domain on set-cookie headers
  • locationRewrite: boolean turns on rewriting location host+port AND path on redirection. For example if you proxy /api to http://testserver then a header Location: http://testserver/otherapi would be rewritten to Location: http://localhost:8100/api/otherapi.
  • debug: boolean turns on verbose debugging of http-proxy-middleware

I know v1 is quite old, but could these features be of interest for other users and so we might open a pull request ? Or maybe you have some suggestions ?

For case 3) we are willing to implement dynamic proxy based on path. The idea is to redirect on a different server based on a part of the path. Something that would be configurable this way:

{
      "path": "/api/*",
      "proxyUrl": "http://$1/"
}
Ngôn ngữ chính
TypeScript
Star
2k
Fork
681
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ionic-team/ionic-cli

Tất cả issue của ionic-team/ionic-cli

Issue tương tự

Thêm issue về TypeScript

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.