Skip to content

Commit ed2f050

Browse files
Apply suggestions from code review
Co-authored-by: Alan Dooley <[email protected]>
1 parent 664a9eb commit ed2f050

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

site/content/how-to/traffic-management/request-response-headers.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ service/headers ClusterIP 10.96.26.161 <none> 80/TCP 23s
8181

8282
---
8383

84-
---
85-
8684
### Configure the HTTPRoute with RequestHeaderModifier filter
8785

8886
Create a HTTPRoute that exposes the header application outside the cluster using the listener created in the previous section. Use the following command:
@@ -159,7 +157,6 @@ curl -s --resolve echo.example.com:$GW_PORT:$GW_IP http://echo.example.com:$GW_P
159157
header 'Accept' is '*/*'
160158
```
161159

162-
163160
In the output above, you can see that the headers application modifies the following custom headers:
164161

165162
- `User-Agent` header is absent.
@@ -198,7 +195,6 @@ This will create the headers Service and a Deployment with one Pod. Run the foll
198195
```shell
199196
kubectl get pods,svc
200197
```
201-
202198
```text
203199
NAME READY STATUS RESTARTS AGE
204200
pod/headers-6f854c478-hd2jr 1/1 Running 0 95s
@@ -209,7 +205,7 @@ service/headers ClusterIP 10.96.15.12 <none> 80/TCP 95s
209205

210206
### Configure the basic HTTPRoute
211207

212-
Next, let's create a simple HTTPRoute that exposes the header application outside the cluster using the listener created in the previous section. To do this, create the following HTTPRoute:
208+
Create a HTTPRoute that exposes the header application outside the cluster using the listener created in the previous section. You can do this with the following command:
213209

214210
```yaml
215211
kubectl apply -f - <<EOF
@@ -242,12 +238,11 @@ This HTTPRoute has a few important properties:
242238

243239
### Send traffic to the Headers application
244240

245-
We will use `curl` with the `-i` flag to access the application and include the response headers in the output:
241+
Use `curl` with the `-i` flag to access the application and include the response headers in the output:
246242

247243
```shell
248244
curl -i --resolve cafe.example.com:$GW_PORT:$GW_IP http://cafe.example.com:$GW_PORT/headers
249245
```
250-
251246
```text
252247
HTTP/1.1 200 OK
253248
Server: nginx/1.25.5
@@ -270,11 +265,11 @@ In the output above, you can see that the headers application adds the following
270265
- X-Header-Set: overwrite
271266
- X-Header-Remove: remove
272267

273-
In the next section we will modify these headers by adding a ResponseHeaderModifier filter to the headers HTTPRoute.
268+
The next section will modify these headers by adding a ResponseHeaderModifier filter to the headers HTTPRoute.
274269

275270
### Update the HTTPRoute to modify the Response headers
276271

277-
Let's update the HTTPRoute by adding a `ResponseHeaderModifier` filter:
272+
Update the HTTPRoute by adding a `ResponseHeaderModifier` filter:
278273

279274
```yaml
280275
kubectl apply -f - <<EOF
@@ -319,7 +314,7 @@ Notice that this HTTPRoute has a `ResponseHeaderModifier` filter defined for the
319314

320315
### Send traffic to the modified Headers application
321316

322-
We will send a curl request to the modified `headers` application and verify the response headers are modified.
317+
Send a curl request to the modified `headers` application to verify the response headers are modified.
323318

324319
```shell
325320
curl -i --resolve cafe.example.com:$GW_PORT:$GW_IP http://cafe.example.com:$GW_PORT/headers
@@ -339,11 +334,11 @@ X-Header-Set: overwritten-value
339334
ok
340335
```
341336

342-
In the output above, you can see that the headers application modifies the following custom headers:
343-
344337
In the output above you can notice the modified response headers as the `X-Header-Unmodified` remains unchanged as we did not include it in the filter and `X-Header-Remove` header is absent. The header `X-Header-Add` gets appended with the new value and `X-Header-Set` gets overwritten to `overwritten-value` as defined in the *HttpRoute*.
345338

346-
## Further Reading
339+
---
340+
341+
## Further reading
347342

348343
To learn more about the Gateway API and the resources we created in this guide, check out the following Kubernetes documentation resources:
349344

0 commit comments

Comments
 (0)