Reverse proxy error with Gateway API behind Envoy Gateway

4 minute readKnowledge baseLast reviewed 2026-11-13 ()

Issue

Cloudbees CI on modern cloud platforms shows the following banner on the Jenkins dashboard:

Your reverse proxy set up is broken

This occurs on operations center and on a managed controller when both of the following are true:

  • You deploy Cloudbees CI on modern cloud platforms with Gateway API, using Envoy Gateway as the Gateway API implementation.

  • TLS terminates upstream of Envoy Gateway, for example at an external load balancer, so the connection between the load balancer and Envoy Gateway is plain HTTP.

Running the following script from the Jenkins Script Console confirms the root URL inferred by Jenkins does not match the externally configured https URL:

Jenkins.get().getRootUrlFromRequest()
▼

Inspecting the inbound request headers, per the Reverse Proxy troubleshooting guide, shows X-Forwarded-Proto arriving as http even though the load balancer serves the site over https.

This prevents Jenkins from reporting the correct root URL and keeps the reverse proxy warning banner displayed.

Explanation

Two independent Envoy Gateway ClientTrafficPolicy defaults cause this, and both can contribute to the same symptom.

Untrusted X-Forwarded-Proto

Envoy Gateway’s ClientTrafficPolicy field clientIPDetection.xForwardedFor.numTrustedHops defaults to 0. Envoy’s own documentation states that downstream X-Forwarded-Proto headers are only trusted when numTrustedHops is non-zero. With the default of 0, Envoy ignores any X-Forwarded-Proto value set by the load balancer and instead derives the scheme from its own connection to the load balancer. Since that connection is plain HTTP, Envoy sets X-Forwarded-Proto to http regardless of what the load balancer intended.

If the load balancer does not set X-Forwarded-Proto at all, for example an AWS Network Load Balancer using the PROXY protocol, raising numTrustedHops has no effect, because there is no existing header value for it to trust. In that case, Envoy falls back to its scheme-inference logic: it checks the PROXY-protocol-restored destination port against configured httpsDestinationPorts/httpDestinationPorts, and if those are not configured, falls back further to whether Envoy’s own connection is TLS, which it is not. The result is the same: X-Forwarded-Proto reaches Jenkins as http.

Escaped-slash redirect normalization

Jenkins' reverse-proxy self-check URL-encodes the Referer header into a redirect Location to verify a round trip. Envoy Gateway’s ClientTrafficPolicy field path.escapedSlashesAction defaults to UnescapeAndRedirect. With that default, Envoy Gateway decodes the encoded path segment and issues its own intermediate redirect before Jenkins' check completes its round trip, which breaks the check independently of the X-Forwarded-Proto issue above.

Why patching the HTTPRoute does not work

Setting X-Forwarded-Proto directly with a RequestHeaderModifier filter on the HTTPRoute does not resolve this on its own. As long as numTrustedHops is 0, Envoy recomputes and overwrites X-Forwarded-Proto after the filter runs, so the injected value never reaches Jenkins.

Additionally, for a managed controller, the operations center generates and overwrites that controller’s HTTPRoute on every provisioning operation and restart. Any direct patch to that HTTPRoute — including a Kubernetes Advanced YAML contribution, a direct kubectl patch, or a GitOps post-renderer — does not persist. The Gateway resource itself, in contrast, is customer-managed and is not created, read, or reconciled by the operations center, so a policy that targets the Gateway survives controller restarts and applies to the operations center and every managed controller at once.

Resolution

CloudBees cannot address this at the product level because the behavior originates in Envoy Gateway’s ClientTrafficPolicy defaults, and the Gateway resource that the policy targets is customer-managed. Apply a ClientTrafficPolicy that targets the shared Gateway resource. Choose the variant that matches your load-balancer topology.

Variant A: load balancer sets X-Forwarded-Proto correctly

Use this variant when the component in front of Envoy Gateway already sends a correct X-Forwarded-Proto header, for example a reverse proxy that terminates TLS and sets the header itself.

  1. Create a ClientTrafficPolicy that targets your Gateway resource (replace eg and ci with your Gateway name and namespace):

    apiVersion: gateway.envoyproxy.io/v1alpha1 kind: ClientTrafficPolicy metadata: name: trust-upstream-proxy namespace: ci spec: targetRefs: - group: gateway.networking.k8s.io kind: Gateway name: eg clientIPDetection: xForwardedFor: numTrustedHops: 1 path: escapedSlashesAction: KeepUnchanged
    ▼
  2. Apply the policy:

    kubectl apply -f client-traffic-policy.yaml
    ▼
  3. Confirm with the Script Console headers check from the Reverse Proxy troubleshooting guide that X-Forwarded-Proto now arrives as https.

Variant B: load balancer uses the PROXY protocol and does not set X-Forwarded-Proto

Use this variant when the load balancer does not send X-Forwarded-Proto at all, for example an AWS Network Load Balancer with the PROXY protocol enabled. In this topology, numTrustedHops has no header to trust, so it does not fix the issue and is unnecessary.

Use the proxyProtocol.forwardProtoConfig.httpsDestinationPorts field, available in current Envoy Gateway releases, which infers https directly from the PROXY-protocol destination port without injecting a header. Combine it with clientIPDetection.directSourceIP to keep the real client IP address that the PROXY protocol already provides, with no X-Forwarded-For spoofing exposure.

  1. Create a ClientTrafficPolicy that targets your Gateway resource (replace eg and ci with your Gateway name and namespace, and 443 with the port your load balancer forwards HTTPS traffic to):

    apiVersion: gateway.envoyproxy.io/v1alpha1 kind: ClientTrafficPolicy metadata: name: trust-upstream-proxy namespace: ci spec: targetRefs: - group: gateway.networking.k8s.io kind: Gateway name: eg clientIPDetection: directSourceIP: {} proxyProtocol: forwardProtoConfig: httpsDestinationPorts: [443] path: escapedSlashesAction: KeepUnchanged
    ▼
  2. Apply the policy:

    kubectl apply -f client-traffic-policy.yaml
    ▼
  3. Confirm with the Script Console headers check from the Reverse Proxy troubleshooting guide that X-Forwarded-Proto now arrives as https.

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by Cloudbees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.