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.

Forward request URL as header

Page as Markdown

Construct a full request URL from context variables and forward it upstream as a request header.

Use CEL expressions to construct a full request URL from context variables and forward it upstream as a request header. The example uses request.scheme, request.host, and request.path.

Before you begin

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

Forward the request URL upstream

In this example, you concatenate request.scheme, request.host, and request.path to build a full URL and inject it into the x-forwarded-uri request header before forwarding to the upstream service.

  1. 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:
            set:
            - name: x-forwarded-uri
              value: 'request.scheme + "://" + request.host + request.path'
    EOF
  2. Send a request to the httpbin app. Verify that you get back a 200 HTTP response code and that you see the constructed URL in the x-forwarded-uri request header echoed back by httpbin.

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

    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"
        ],
        "X-Forwarded-Uri": [
          "http://www.example.com/get"
        ]
      },
      "origin": "10.244.0.6:59296",
      "url": "http://www.example.com/get"
    }
    

Cleanup

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