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
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,16 +6,16 @@ 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/29/2023
9
+
ms.date: 07/30/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 resources from Gateway API to demonstrate traffic routing based on URL path, query string, and header:
16
-
-[Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) - creating a gateway with one https listener
17
-
-[HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) - creating an HTTP route that references a backend service
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.
15
+
This document helps you set up an example application that uses the resources from Gateway API to demonstrate traffic routing based on URL path, query string, and header. Review the following gateway API resources for more information:
16
+
-[Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) - create a gateway with one HTTPS listener.
17
+
-[HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) - create an HTTP route that references a backend service.
18
+
-[HTTPRouteMatch](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.HTTPRouteMatch) - Use`matches` to route based on path, header, and query string.
19
19
20
20
## Prerequisites
21
21
@@ -157,9 +157,9 @@ status:
157
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
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.
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 is sent to backend-v2 on port 8080.
162
+
3) Otherwise, all other requests are routed to backend-v1 service on port 8080.
By using the curl command, we can validate three different scenarios:
251
251
252
252
### Path based routing
253
-
In this scenario, the client request sent to http://frontend-fqdn/barwill be routed to backend-v2 service.
253
+
In this scenario, the client request sent to http://frontend-fqdn/baris routed to backend-v2 service.
254
254
255
255
Run the following command:
256
256
```bash
@@ -260,7 +260,7 @@ curl http://$fqdn/bar
260
260
Notice the container serving the request is backend-v2.
261
261
262
262
### Query string + header + path routing
263
-
In this scenario, the 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.
263
+
In this scenario, the client request sent to http://frontend-fqdn/some/thing?great=example with a header key/value part of "magic: foo" is routed to backend-v2 service.
0 commit comments