How to enable proxy to get real client Ip using traefik

Hi,
i would like to get the real Ip of the client, i know that i need to enable proxy, i have succesfully done that for nginxi but i don't know how to do that for traefik,
please help

what i have tried is the following

Add this annonation to the LoadBalancer service
service.beta.kubernetes.io/linode-loadbalancer-enable-proxy-protocol: v2

i have enabled proxy v2 in the linode dashboard

i have added the following annonations to my ingress
service.beta.kubernetes.io/linode-loadbalancer-enable-proxy-protocol: v2
traefik.ingress.kubernetes.io/frontend-entry-points: https
traefik.ingress.kubernetes.io/router.entrypoints: web, websecure
use-proxy-protocol: "true"

1 Reply

Hello badrdouah,

Please refer to the documentation below to use proxyprotocol on traefik.

https://doc.traefik.io/traefik/v2.0/routing/entrypoints/

Examples:

File (YAML)

Static configuration

entryPoints:
web:
address: ":80"
proxyProtocol:
trustedIPs:
- "127.0.0.1/32"
- "192.168.1.7"

CLI

--entryPoints.web.address=:80
--entryPoints.web.proxyProtocol.trustedIPs=127.0.0.1/32,192.168.1.7

File (TOML)

Static configuration

[entryPoints]
[entryPoints.web]
address = ":80"

[entryPoints.web.proxyProtocol]
  trustedIPs = ["127.0.0.1/32", "192.168.1.7"]

~ Andy | NexusPIPE

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct