Skip to content
Latest (currently 2026.10.2) has the newest features, bug fixes, and CVE patches of Solo Enterprise for agentgateway.

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Host redirect

Verified : Automated tests passed for: End-to-end run: Every step ran in a fresh test environment and the results were checked.
Page as Markdown

Redirect requests to a different host.

For more information, see the Kubernetes Gateway API documentation.

Before you begin

  1. Set up an agentgateway proxy.
  2. Install the httpbin sample app.

Set up host redirects

  1. Create an HTTPRoute for the httpbin app. In the following example, requests for the host.redirect.example domain are redirected to the www.example.com hostname, and a 302 HTTP response code is returned to the user.

    kubectl apply -f- <<EOF
    apiVersion: gateway.networking.k8s.io/v1
    kind: HTTPRoute
    metadata:
      name: httpbin-redirect
      namespace: httpbin
    spec:
      parentRefs:
        - name: agentgateway-proxy
          namespace: agentgateway-system
      hostnames:
        - host.redirect.example
      rules:
        - matches:
            - path:
                type: PathPrefix
                value: /
          filters:
            - type: RequestRedirect
              requestRedirect:
                hostname: "www.example.com"
                statusCode: 302
    EOF
  2. Send a request to the httpbin app on the host.redirect.example domain and verify that you get back a 302 HTTP response code and the redirect location www.example.com/headers.

    curl -vi http://$INGRESS_GW_ADDRESS:80/headers -H "host: host.redirect.example:80"
    curl -vi localhost:8080/headers -H "host: host.redirect.example"

    Example output:

    * Mark bundle as not supporting multiuse
    < HTTP/1.1 302 Found
    HTTP/1.1 302 Found
    < location: http://www.example.com/headers
    location: http://www.example.com/headers
    < server: envoy
    server: envoy
    < content-length: 0
    content-length: 0

Cleanup

You can remove the resources that you created in this guide.
kubectl delete httproute httpbin-redirect -n httpbin --ignore-not-found