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.

Promote query parameters to headers

Page as Markdown

Promote a query parameter to a request header using CEL expressions.

Promote a query parameter to a request header by using CEL expressions. The example uses request.uri with the contains() function and a conditional expression to read a query parameter value and inject it as a request header before the request reaches the upstream.

This configuration is useful when a client passes information as a query parameter but the backend service expects it as a header.

Before you begin

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

Promote a query parameter to a request header

In this example, a client passes a feature flag as the beta query parameter. The backend service expects this as the x-beta-features request header. The transformation reads request.uri and sets the header to enabled when beta=true is present, and disabled when it is absent.

  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-beta-features
              value: 'request.uri.contains("beta=true") ? "enabled" : "disabled"'
    EOF
  2. Send a request with the beta=true query parameter. Verify that you get back a 200 HTTP response code and that the x-beta-features header is set to enabled in the headers echoed back by httpbin.

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

    Example output:

    < HTTP/1.1 200 OK
    HTTP/1.1 200 OK
    ...
    
    {
      "args": {
        "beta": [
          "true"
        ]
      },
      "headers": {
        "Accept": [
          "*/*"
        ],
        "Host": [
          "www.example.com"
        ],
        "User-Agent": [
          "curl/8.7.1"
        ],
        "X-Beta-Features": [
          "enabled"
        ]
      },
      "origin": "10.244.0.6:12345",
      "url": "http://www.example.com/get?beta=true"
    }
    
  3. Send a request without the beta=true query parameter. Verify that the x-beta-features header is set to disabled.

    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-Beta-Features": [
          "disabled"
        ]
      },
      "origin": "10.244.0.6:12345",
      "url": "http://www.example.com/get"
    }
    

Cleanup

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