Wrong IP address to NginX/PHP

Hello!

I've installed Traefik on Kubernetes ( OVH services ) with the Helm Chart and this TOML configuration.
My NginX/PHP application don't receive the real IP address ( REMOTE_ADDRESS, X-REAL-IP / X-FORWARDED-FOR ).
I've read I need to put passHostHeader = true somewhere but I don't know in which section, I've tried multiple position in the TOML without success. Any idea please?


apiVersion: v1
data:
  traefik.toml: |
    # traefik.toml
    logLevel = "INFO"
    defaultEntryPoints = ["http","https"]
    passHostHeader = true
    [entryPoints]
      [entryPoints.http]
      address = ":80"
      compress = true
      passHostHeader = true
        [entryPoints.http.redirect]
          regex = "^http://(.*)"
          replacement = "https://$1"
      [entryPoints.https]
      address = ":443"
      compress = true
        [entryPoints.https.tls]
          [[entryPoints.https.tls.certificates]]
          CertFile = "/ssl/tls.crt"
          KeyFile = "/ssl/tls.key"
    [kubernetes]
    [traefikLog]
      format = "json"
    [acme]
    email = "xxxxxxxxxxxxxxxl@gmail.com"
    storage = "/acme/acme.json"
    entryPoint = "https"
    onHostRule = true
      [acme.tlsChallenge]
kind: ConfigMap
metadata:
  creationTimestamp: "2019-04-11T08:46:19Z"
  labels:
    app: traefik
    chart: traefik-1.66.0
    heritage: Tiller
    release: traefik
  name: traefik
  namespace: kube-system

Hello @lakano,

If you are needing to preserve the source IP of your requests, you should look at this document:

https://kubernetes.io/docs/tutorials/services/source-ip/

The issue you are encountering is due to kubernetes networking, not Traefik.

Thanks @daniel.tomcej for your help !
So, I don't need at all to put « passHostHeader = true » in traefik.toml ?
It's only related to K8S ?

I've found my K8S provider ( OVH ) have a specific protocol:


This should help if I remove Traefik and directly use NginX.
I'll try to check with my provider if there is a solution to make it compatible with Traefik.
Thanks