Header
Specify a set of headers which incoming requests must match in entirety.
For more information, see the Kubernetes Gateway API documentation.
Before you begin
Follow the Get started guide to install Gloo Gateway, set up a gateway resource, and deploy the httpbin sample app.
Get the external address of the gateway and save it in an environment variable.
Set up header matching
Create an HTTPRoute resource.
Send a request to the httpbin app on the
match.example
domain without any headers. Verify that you get back a 404 HTTP response code as no matching request could be found.Example output:
Send another request to the httpbin app on the
match.example
domain. This time, add theversion: v2
header that you configured in the HTTP route. Verify that your request now succeeds and you get back a 200 HTTP response code.Example output:
Cleanup
You can optionally delete the HTTP route that you created as part of this guide.