[Bug]: Updating a REST API on the gateway doesn't resolve its vhosts, so _gateway_default_ is stored as a hostname
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Đọc gateway/gateway-controller/pkg/service/restapi/service.go, đặc biệt là RestAPIService.Update và luồng tạo thông qua DeployAPIConfiguration; so sánh cách mỗi luồng xử lý vhosts. Sau đó kiểm tra gateway/gateway-controller/pkg/utils/api_deployment.go và hàm resolveVhostSentinels trong tệp này. Công việc hoàn tất khi các lần cập nhật phân giải _gateway_default_ và các vhost bị thiếu thành giá trị mặc định hiện tại của gateway, còn GET trả về các giá trị đã phân giải; kiểm tra xem có các bài kiểm thử cập nhật REST API hiện có để xác nhận hành vi này hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Please select the area the issue is related to
Gateway
Please select the aspect the issue is related to
Aspect/API (API backends, definitions, contracts, interfaces, OpenAPI)
Description
When a REST API is created on the gateway, its vhosts are resolved at deploy time: _gateway_default_, or a missing vhosts block, becomes the gateway's current default hosts. The resolved values are stored, so a later change to the gateway defaults doesn't move the API (discussion #369).
Updating the API through the gateway's REST API (PUT /rest-apis/{id}) skips that step:
- With
vhosts.main: _gateway_default_: the placeholder is stored literally, as a hostname. The API stops answering on the default hosts. - With no
vhostsblock: nothing is stored. The API keeps answering on the defaults only because the router falls back to the live default. So it follows the next config change, which is what deploy-time resolution is meant to prevent, andGETshows no vhosts.
Observed (gateway with router.vhosts.main.default = "*.wso2.com" and router.vhosts.sandbox.default = "*-sandbox.wso2.com")
POST /rest-apiswith novhosts:GET /rest-apis/{id}showsspec.vhosts.main*.wso2.comandspec.vhosts.sandbox*-sandbox.wso2.com, and a request withHost: api.wso2.comanswers 200.PUT /rest-apis/{id}withvhosts: {"main": "_gateway_default_"}:GETshowsspec.vhosts.main_gateway_default_, and the same request now answers 404.PUT /rest-apis/{id}with novhosts:GETshows nospec.vhostsat all.
Expected
An update resolves vhosts the same way a create does. _gateway_default_ and a missing vhosts block become the current gateway defaults, which are stored and shown by GET.
Cause
Create goes through DeployAPIConfiguration (gateway/gateway-controller/pkg/service/restapi/service.go:174), which calls resolveVhostSentinels (gateway/gateway-controller/pkg/utils/api_deployment.go:312). RestAPIService.Update (pkg/service/restapi/service.go:320) parses the body and saves it without that call. The event gateway's WebSub update does resolve vhosts, because it goes through DeployAPIConfiguration.
Steps to Reproduce
- Start a gateway with
[router.vhosts.main] default = "*.wso2.com". - Create a REST API with no
vhoststhroughPOST /rest-apis. A request withHost: api.wso2.comanswers 200. - Update it through
PUT /rest-apis/{id}with"vhosts": {"main": "_gateway_default_"}. GET /rest-apis/{id}shows_gateway_default_, and the request withHost: api.wso2.comanswers 404.- Update it again with no
vhosts:GETshows no vhosts.
Severity Level of the Issue
Severity/Major (Important functionality is broken. Should be prioritized. Doesn't need immediate attention)
Environment Details (with versions)
Current main (e90cde473). Platform-api and gateway built from source and run by the IT suite (tests/framework), on macOS with Rancher Desktop.
- Ngôn ngữ chính
- Go
- Star
- 85
- Fork
- 137
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 247
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của wso2/api-platform
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
wso2/api-platform#4369 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy acceptsĐang mởArea/Policies Aspect/Other Severity/Trivial Type/Bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
wso2/api-platform#4355 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area/Gateway Aspect/API Severity/Minor Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
wso2/api-platform#4348 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Aspect/AI Aspect/API. Severity/Major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
wso2/api-platform#4343 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: content-length-guardrail policy accepts a non-string streamingJsonPath at API creationĐang mởArea/Policies Aspect/Configuration Severity/Minor Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
wso2/api-platform#4330 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của wso2/api-platform
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
needs discussion
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openfga/openfga.dev#1436 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
都道府県を指定すると区名から始まる住所に市名を補わないĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
digital-go-jp/abr-geocoder#457 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
benchmark
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
mozilla-ai/cq#601 ·
Maintainer thường phản hồi trong vòng 1 ngày