You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -116,10 +134,19 @@ This HTTPRoute has a few important properties:
116
134
- The `parentRefs` references the gateway resource that we created, and specifically defines the `http` listener to attach to, via the `sectionName` field.
117
135
-`cafe.example.com` is the hostname that is matched for all requests to the backends defined in this HTTPRoute.
118
136
- The first rule defines that all requests with the path prefix `/coffee` and no other matching conditions are sent to the `coffee-v1` Service.
119
-
- The second rule defines two matching conditions. If _either_ of these conditions match, requests are forwarded to the `coffee-v2` Service:
137
+
- The second rule defines two matching conditions. If *either* of these conditions match, requests are forwarded to the `coffee-v2` Service:
138
+
139
+
- Request with the path prefix `/coffee` and header `version=v2`.
140
+
- Request with the path prefix `/coffee` and the query parameter `TEST=v2`.
141
+
142
+
{{< note >}} The match type is `Exact` for both header and query param, by default. {{< /note >}}
143
+
144
+
- The third rule defines two matching conditions. If *either* of these conditions match, requests are forwarded to the `coffee-v3` Service:
120
145
121
-
- Request with the path prefix `/coffee` and header `version=v2`
122
-
- Request with the path prefix `/coffee` and the query parameter `TEST=v2`
146
+
- Request with the path prefix `/coffee` and header `HeaderRegex=Header-[a-z]{1}`.
147
+
- Request with the path prefix `/coffee` and the query parameter `QueryRegex=Query-[a-z]{1}`.
148
+
149
+
{{< note >}} The match type used here is `RegularExpression`. A request will succeed if the header or query parameter value matches the specified regular expression. {{< /note >}}
123
150
124
151
If you want both conditions to be required, you can define headers and queryParams in the same match object.
125
152
@@ -161,6 +188,25 @@ Server address: 10.244.0.9:8080
161
188
Server name: coffee-v2-68bd55f798-s9z5q
162
189
```
163
190
191
+
If we want our request to be routed to `coffee-v3`, then we need to meet the defined conditions. We can include a header matching the regular expression:
0 commit comments