feat(wasm-go): add field reroute to disable route reselection (#2739)

This commit is contained in:
WeixinX
2025-08-11 09:37:35 +08:00
committed by GitHub
parent a1bf1ff009
commit 33ce18df5a
7 changed files with 312 additions and 54 deletions

View File

@@ -28,8 +28,28 @@ static_resources:
routes:
- match:
prefix: "/"
route:
cluster: httpbin
headers: [
{
name: "reroute",
string_match: { "exact": "false" }
}
]
direct_response:
status: 200
body: { inline_string: "no rerouting" }
- match:
prefix: "/"
headers: [
{
name: "reroute",
string_match: { "exact": "true" }
}
]
direct_response:
status: 200
body: { inline_string: "rerouting" }
# route:
# cluster: httpbin
http_filters:
- name: wasmdemo
typed_config:
@@ -47,25 +67,14 @@ static_resources:
"@type": "type.googleapis.com/google.protobuf.StringValue"
value: |
{
"reroute": false,
"reqRules": [
{
"operate": "replace",
"headers": [
{
"key": "hello",
"newValue": "higress"
}
],
"querys": [
{
"key": "k1",
"newValue": "newQueryV1"
}
],
"body": [
{
"key": "k2",
"newValue": "newBodyV2"
"key": "reroute",
"newValue": "true"
}
]
}
@@ -74,19 +83,19 @@ static_resources:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
clusters:
- name: httpbin
connect_timeout: 30s
type: LOGICAL_DNS
# Comment out the following line to test on v6 networks
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: httpbin
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: httpbin
port_value: 80
# clusters:
# - name: httpbin
# connect_timeout: 30s
# type: LOGICAL_DNS
# # Comment out the following line to test on v6 networks
# dns_lookup_family: V4_ONLY
# lb_policy: ROUND_ROBIN
# load_assignment:
# cluster_name: httpbin
# endpoints:
# - lb_endpoints:
# - endpoint:
# address:
# socket_address:
# address: httpbin
# port_value: 80