Description
Describe the bug
HTTPRoute filters does not honor the user provided value for already existing headers.
To Reproduce
Steps to reproduce the behavior:
Apply the gateway.yaml and headers application
use the following HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: headers
spec:
parentRefs:
- name: gateway
sectionName: http
hostnames:
- "echo.example.com"
rules:
- matches:
- path:
type: PathPrefix
value: /headers
filters:
- type: RequestHeaderModifier
requestHeaderModifier:
set:
- name: X-Forwarded-Proto
value: https
backendRefs:
- name: headers
port: 80
The header X-Forwarded-Proto
Nginx Config
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Proto "https";
proxy_set_header Host "$gw_api_compliant_host";
proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
proxy_set_header X-Real-IP "$remote_addr";
proxy_set_header X-Forwarded-Proto "$scheme";
proxy_set_header X-Forwarded-Host "$host";
proxy_set_header X-Forwarded-Port "$server_port";
proxy_set_header Upgrade "$http_upgrade";
proxy_set_header Connection "$connection_upgrade";
proxy_pass http://default_headers_80$request_uri;
The header is X-Forwarded-Proto
set twice.
Expected behavior
We need to set the header X-Forwarded-Proto
once to https
(user provided value).
Your environment
- Version of the NGINX Gateway Fabric - release version or a specific commit. The first line of the nginx-gateway container logs includes the commit info. -- edge
- Version of Kubernetes
- Kubernetes platform (e.g. Mini-kube or GCP)
- Details on how you expose the NGINX Gateway Fabric Pod (e.g. Service of type LoadBalancer or port-forward)
- Logs of NGINX container:
kubectl -n nginx-gateway logs -l app=nginx-gateway -c nginx
- NGINX Configuration:
kubectl -n nginx-gateway exec <gateway-pod> -c nginx -- nginx -T
Additional context
Add any other context about the problem here. Any log files you want to share.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done