Strip the trailing Host dot on every Gateway listener

What does this MR do?

Envoy Gateway matches the Host header literally, so a request to an absolute FQDN such as https://registry.example.com./ gets 404 route_not_found. NGINX normalized these requests. Since chart 10.3, stripTrailingHostDot has been set only on the Webservice section-scoped ClientTrafficPolicy resources, and only when global.hosts.https is true. That leaves two gaps:

  • Listeners other than Webservice (registry, Pages, KAS, OpenBao, AI Gateway) are never covered.
  • HTTPS-terminating listeners with global.hosts.https: false get no policy at all. The listener protocol comes from gatewayApiResources.gateway.protocol, which defaults to HTTPS, not from global.hosts.https. This matches the docs feedback in the related work item ("stripTrailingHostDot do not work on tls listener").

This MR:

  • Defaults the gateway-wide ClientTrafficPolicy (gatewayApiResources.envoy.clientTrafficPolicySpec) to headers.host.stripTrailingHostDot: true. It covers every listener that no section-scoped policy overrides, including the documented HTTP-only mode. User settings merge with this default; headers: null drops it.
  • Sets the same field on the KAS section-scoped policy, which overrides the gateway-wide one on kas-web.
  • Documents which listeners each chart version covers, and the workaround for 10.3 to 10.5.

The chart now renders the gateway-wide ClientTrafficPolicy by default (<release>-policy). Where a section-scoped policy covers a listener, Envoy Gateway reports Overridden=True on the gateway-wide one. That condition is informational only.

A companion MR handles the remaining case, with HTTPS hosts on HTTP listeners, where Envoy Gateway rejects the section-scoped policies: !5486 (closed).

Related to https://gitlab.com/gitlab-org/gitlab/-/work_items/629584

E2E validation

GKE 1.36 (3 × e2-standard-4) with the bundled Envoy Gateway 1.9.1 and cert-manager. Real Let's Encrypt certificates (HTTP-01 through the Gateway) for gitlab., registry. and kas. on a real test domain (shown as example.com below), on a static IP. Requests came from outside the cluster with full certificate verification. Each request was matched to Envoy's access log by user agent to read response_code_details.

Expected status without a dot: gitlab 200, registry 401 (/v2/), kas 415 or 426. A 404 route_not_found means no route matched.

Scenario Host with trailing dot master This MR
Default (hosts.https: true, HTTPS listeners) gitlab. 200 200
registry. 404 route_not_found 401 via_upstream
kas. 404 route_not_found 415 via_upstream
hosts.https: false, default HTTPS listeners gitlab. 404 route_not_found 200
registry. 404 route_not_found 401 via_upstream
kas. 404 route_not_found 415 via_upstream
Documented HTTP-only mode (hosts.https: false, protocol: HTTP) all three (not measured; the CI values set the field explicitly) 200 / 401 / 426 via_upstream

The curl client strips the dot from SNI, so only :authority carries it. The Envoy access log confirms this ("requested_server_name":"registry.example.com", ":authority":"registry.example.com."), and TLS listener selection works as expected.

Specs: spec/configuration gives the same result as master locally. The only failures are Gitaly and GitLab Shell specs, which fail identically on master because gomplate is missing on the workstation.

Author checklist

For general guidance, please follow our Contributing guide.

Required

For anything in this list which will not be completed, please provide a reason in the MR discussion.

  • Merge Request Title and Description are up to date, accurate, and descriptive.
  • MR targeting the appropriate branch.
  • MR has a green pipeline.
  • Documentation created/updated.
  • Tests added/updated.
  • Have you validated that your change works end-to-end on a real cluster deployment?
    • Describe how you did it in a comment.
  • Equivalent MR/issue for omnibus-gitlab opened.
  • When ready for review, MR is marked as ready (not a draft) and assigned to a reviewer.

Reviewers checklist

🤖 Generated with Claude Code

Edited by João Alexandre Cunha

Merge request reports

Loading
Loading