Skip to content
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

X-Forwarded-For header missing #1023

Closed
wedobetter opened this issue Sep 5, 2023 · 3 comments
Closed

X-Forwarded-For header missing #1023

wedobetter opened this issue Sep 5, 2023 · 3 comments

Comments

@wedobetter
Copy link

Description of the problem
X-Forwarded-For header not working tried ignore and ifmissing and in both cases I end up with the same haproxy.cfg:

backend
   ...
    http-request set-header X-Original-Forwarded-For %[hdr(x-forwarded-for)] if { hdr(x-forwarded-for) -m found }
    http-request del-header x-forwarded-for
    option forwardfor

I am worried of http-request del-header x-forwarded-for, the backend is not receiving the header.

Expected behavior

x-forwarded-for header correctly set

Steps to reproduce the problem

Annotate:
ingress.kubernetes.io/forwardfor: ifmissing
or
ingress.kubernetes.io/forwardfor: ignore

Environment information

HAProxy Ingress version: v0.14.5

Command-line options:

(paste command-line options here)

Global options:

  bind-http: xxxx:80
  bind-https: xxxx:443
  default-ssl-certificate: haproxy/cert
  healthz-port: "10253"
  nbthread: "7"
  reload-strategy: reusesocket
  ssl-redirect: "true"
  stats-port: "1936"
  syslog-endpoint: xxxx:514
  syslog-tag: haproxy
  use-htx: "true"
  watch-ingress-without-class: "true"

Ingress objects:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/forwardfor: ifmissing
...
@github-actions
Copy link

github-actions bot commented Oct 9, 2023

This issue got stale and will be closed in 7 days.

@jcmoraisjr
Copy link
Owner

Hi, how did you make this test? I cannot reproduce it, and just added an integration test that explores this functionality on #1115

Note that the option forwardfor configuration is the one that adds the XFF header, so it seems that your generated haproxy.cfg file is right.

Copy link

This issue got stale and will be closed in 7 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants