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
Copy file name to clipboardExpand all lines: articles/application-gateway/for-containers/how-to-path-header-query-string-routing-gateway-api.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,13 @@ author: greglin
6
6
ms.service: application-gateway
7
7
ms.subservice: appgw-for-containers
8
8
ms.topic: how-to
9
-
ms.date: 07/28/2023
9
+
ms.date: 07/31/2023
10
10
ms.author: greglin
11
11
---
12
12
13
13
# Path, header, and query string routing with Application Gateway for Containers - Gateway API (preview)
14
14
15
-
This document helps set up an example application that uses the following resources from Gateway API:
15
+
This document helps set up an example application that uses resources from Gateway API to demonstrate traffic routing based on URL path, query string, and header:
16
16
-[Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) - creating a gateway with one https listener
17
17
-[HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) - creating an HTTP route that references a backend service
18
18
-[HttpRouteMatch](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.HTTPRouteMatch) - Using `matches` to route based on path, header, and query string.
@@ -154,12 +154,12 @@ status:
154
154
kind: HTTPRoute
155
155
```
156
156
157
-
Once the gateway has been created, create an HTTPRoute.
157
+
Once the gateway has been created, create an HTTPRoute to define two different matches and a default service to route traffic to.
158
158
159
-
In this example, the following behavior is observed:
160
-
1. Path based routing: Client request sent to http://frontend-fqdn/bar will be routed to backend-v2 service
161
-
2. Query string + header + path routing: Client request sent to http://frontend-fqdn/some/thing?great=example with a header key/value part of "magic: foo" will be routed to backend-v2 service.
162
-
3. If neither of the first two scenarios are satisfied, Application Gateway for Containers routes the request to backend-v1 service.
159
+
The way the following rules read are as follows:
160
+
1) If the path is /bar, traffic is routed to backend-v2 service on port 8080 OR
161
+
2) If the request contains an HTTP header with the name magic and the value foo, the URL contains a query string defining the name great with a value of example, AND the path is /some/thing, the request will be sent to backend-v2 on port 8080.
162
+
3) Else all other requests will be routed to backend-v1 service on port 8080.
0 commit comments