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.

Remove request headers

Page as Markdown

Remove headers from requests before they reach the upstream.

Remove headers from requests before they reach the upstream. Use this when a client sends headers that the backend service should not receive, such as internal routing hints, authentication tokens, or debugging headers added by a proxy.

Before you begin

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

Remove request headers

In this example, you remove the x-debug-trace request header before the request is forwarded to the upstream.

  1. Send a request to the httpbin app and include the x-debug-trace request header. Verify that httpbin echoes it back in the response body.

    curl -s http://$INGRESS_GW_ADDRESS:80/get \
     -H "host: www.example.com:80" \
     -H "x-debug-trace: true"
    curl -s localhost:8080/get \
    -H "host: www.example.com" \
    -H "x-debug-trace: true"

    Example output:

    {
      "args": {},
      "headers": {
        "Accept": [
          "*/*"
        ],
        "Host": [
          "www.example.com"
        ],
        "User-Agent": [
          "curl/8.7.1"
        ],
        "X-Debug-Trace": [
          "true"
        ]
      },
      "origin": "10.244.0.6:12345",
      "url": "http://www.example.com/get"
    }
    

    The x-debug-trace header is present in the echoed headers.

  2. Create an EnterpriseAgentgatewayPolicy resource with your transformation rules.

    kubectl apply -f- <<EOF
    apiVersion: enterpriseagentgateway.solo.io/v1alpha1
    kind: EnterpriseAgentgatewayPolicy
    metadata:
      name: transformation
      namespace: httpbin
    spec:
      targetRefs:
      - group: gateway.networking.k8s.io
        kind: HTTPRoute
        name: httpbin
      traffic:
        transformation:
          request:
            remove:
            - x-debug-trace
    EOF
  3. Send another request with the x-debug-trace request header. Verify that you get back a 200 HTTP response code and that the x-debug-trace header is no longer present in the headers echoed back by httpbin.

    curl -vi http://$INGRESS_GW_ADDRESS:80/get \
     -H "host: www.example.com:80" \
     -H "x-debug-trace: true"
    curl -vi localhost:8080/get \
    -H "host: www.example.com" \
    -H "x-debug-trace: true"

    Example output:

    < HTTP/1.1 200 OK
    HTTP/1.1 200 OK
    ...
    
    {
      "args": {},
      "headers": {
        "Accept": [
          "*/*"
        ],
        "Host": [
          "www.example.com"
        ],
        "User-Agent": [
          "curl/8.7.1"
        ]
      },
      "origin": "10.244.0.6:12345",
      "url": "http://www.example.com/get"
    }
    

    The x-debug-trace header is absent from the echoed headers, confirming it was stripped before the request reached the upstream.

Cleanup

You can remove the resources that you created in this guide.
kubectl delete EnterpriseAgentgatewayPolicy transformation -n httpbin