haproxy-ingress icon indicating copy to clipboard operation
haproxy-ingress copied to clipboard

X-Forwarded-For header missing

Open wedobetter opened this issue 1 year ago • 2 comments

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
...

wedobetter avatar Sep 05 '23 18:09 wedobetter

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

github-actions[bot] avatar Oct 09 '23 10:10 github-actions[bot]

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.

jcmoraisjr avatar May 01 '24 22:05 jcmoraisjr

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

github-actions[bot] avatar Jun 10 '24 10:06 github-actions[bot]