-
Notifications
You must be signed in to change notification settings - Fork 126
Add request header tutorial to how-to guides #2715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
59e8565
update doc to add request header to how to guides
salonichf5 9035521
update rewrite client IP doc
salonichf5 341637d
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 1b9f8e0
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 3f6e706
update based on reviews
salonichf5 5e0036d
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 2ecaf0b
Update examples/http-request-header-filter/README.md
salonichf5 ce05242
Update examples/http-request-header-filter/README.md
salonichf5 0992e1a
Update examples/http-response-header-filter/README.md
salonichf5 b2d37bd
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 3f8e1c1
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 17ee2a1
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 4ef4bc1
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 1639496
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 0f18d58
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 37f6a73
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 6d37b0d
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 eb21ba2
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 8f1c3ea
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 44a8496
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 202416e
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 364137f
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 261ce53
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 3388802
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 50f8aa7
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 0ae238c
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 9781ed0
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 4894da9
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 efc4d64
updates for consistency
salonichf5 0f98c61
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 664a9eb
Update site/content/how-to/traffic-management/request-response-header…
salonichf5 ed2f050
Apply suggestions from code review
salonichf5 05ed810
update guide name
salonichf5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,3 @@ | ||
# Example | ||
# HTTP request headers example | ||
|
||
In this example we will deploy NGINX Gateway Fabric and configure traffic routing for a simple echo server. | ||
We will use HTTPRoute resources to route traffic to the echo server, using the `RequestHeaderModifier` filter to modify | ||
headers to the request. | ||
|
||
## Running the Example | ||
|
||
## 1. Deploy NGINX Gateway Fabric | ||
|
||
1. Follow the [installation instructions](https://docs.nginx.com/nginx-gateway-fabric/installation/) to deploy NGINX Gateway Fabric. | ||
|
||
1. Save the public IP address of NGINX Gateway Fabric into a shell variable: | ||
|
||
```text | ||
GW_IP=XXX.YYY.ZZZ.III | ||
``` | ||
|
||
1. Save the port of NGINX Gateway Fabric: | ||
|
||
```text | ||
GW_PORT=<port number> | ||
``` | ||
|
||
## 2. Deploy the Headers Application | ||
|
||
1. Create the headers Deployment and Service: | ||
|
||
```shell | ||
kubectl apply -f headers.yaml | ||
``` | ||
|
||
1. Check that the Pod is running in the `default` Namespace: | ||
|
||
```shell | ||
kubectl -n default get pods | ||
``` | ||
|
||
```text | ||
NAME READY STATUS RESTARTS AGE | ||
headers-6f4b79b975-2sb28 1/1 Running 0 12s | ||
``` | ||
|
||
## 3. Configure Routing | ||
|
||
1. Create the Gateway: | ||
|
||
```shell | ||
kubectl apply -f gateway.yaml | ||
``` | ||
|
||
1. Create the HTTPRoute resources: | ||
|
||
```shell | ||
kubectl apply -f echo-route.yaml | ||
``` | ||
|
||
## 4. Test the Application | ||
|
||
To access the application, we will use `curl` to send requests to the `headers` Service, including sending headers with | ||
our request. | ||
Notice our configured header values can be seen in the `requestHeaders` section below, and that the `User-Agent` header | ||
is absent. | ||
|
||
```shell | ||
curl -s --resolve echo.example.com:$GW_PORT:$GW_IP http://echo.example.com:$GW_PORT/headers -H "My-Cool-Header:my-client-value" -H "My-Overwrite-Header:dont-see-this" | ||
``` | ||
|
||
```text | ||
Headers: | ||
header 'Accept-Encoding' is 'compress' | ||
header 'My-cool-header' is 'my-client-value, this-is-an-appended-value' | ||
header 'My-Overwrite-Header' is 'this-is-the-only-value' | ||
header 'Host' is 'echo.example.com:$GW_PORT' | ||
header 'X-Forwarded-For' is '$GW_IP' | ||
header 'Connection' is 'close' | ||
header 'Accept' is '*/*' | ||
``` | ||
This directory contains the YAML files used in the [Modify HTTP request and response headers](https://docs.nginx.com/nginx-gateway-fabric/how-to/traffic-management/request-response-headers/) guide. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# HTTP Response Headers | ||
# HTTP response headers example | ||
|
||
This directory contains the YAML files used in the [HTTP Response Headers](https://docs.nginx.com/nginx-gateway-fabric/how-to/traffic-management/response-headers/) guide. | ||
This directory contains the YAML files used in the [Modify HTTP request and response headers](https://docs.nginx.com/nginx-gateway-fabric/how-to/traffic-management/request-response-headers/) guide. | ||
salonichf5 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.