-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Description
Currently, the http gateway in go-zero only supports Path and Method in Mappings, but there is no way to rewrite the route before forwarding to the upstream service.
In many real-world cases, the public API path exposed by the gateway is different from the actual path required by the downstream service. Supporting Rewrite would make the gateway much more flexible.
Example
Upstreams:
- Name: external-cable
Http:
Target: localhost:19103
Timeout: 15000
Mappings:
- Method: POST
Path: /api/abandoned/external/cable/workList
Rewrite: /cable/workList
With this configuration:
The gateway exposes:
POST /api/abandoned/external/cable/workList
But it rewrites and forwards the request to:
POST http://localhost:19103/cable/workList
Metadata
Metadata
Assignees
Labels
No labels