Skip to content

HTTPRoute filters need to apply the user provided value for the existing headers #3192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
salonichf5 opened this issue Mar 3, 2025 · 0 comments · Fixed by #3249
Closed
Assignees
Labels
bug Something isn't working refined Requirements are refined and the issue is ready to be implemented. size/medium Estimated to be completed within a week
Milestone

Comments

@salonichf5
Copy link
Contributor

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.

@salonichf5 salonichf5 added bug Something isn't working and removed bug Something isn't working labels Mar 3, 2025
@salonichf5 salonichf5 added this to the v2.0.0 milestone Mar 3, 2025
@sjberman sjberman added the bug Something isn't working label Mar 3, 2025
@salonichf5 salonichf5 changed the title HTTPRoute filters need to honor the user provided value for existing filters HTTPRoute filters need to honor the user provided value for existing headers Mar 3, 2025
@salonichf5 salonichf5 changed the title HTTPRoute filters need to honor the user provided value for existing headers HTTPRoute filters need to apply the user provided value for the existing headers Mar 3, 2025
@mpstefan mpstefan added size/medium Estimated to be completed within a week refined Requirements are refined and the issue is ready to be implemented. labels Mar 17, 2025
@sjberman sjberman self-assigned this Mar 21, 2025
@sjberman sjberman moved this from 🆕 New to 🏗 In Progress in NGINX Gateway Fabric Mar 21, 2025
@sjberman sjberman moved this from 🏗 In Progress to 👀 In Review in NGINX Gateway Fabric Mar 21, 2025
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✅ Done in NGINX Gateway Fabric Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refined Requirements are refined and the issue is ready to be implemented. size/medium Estimated to be completed within a week
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants