I was trying to add
X-Forwarded-Proto header to the request using middleware, but it did not work.
I found this article How to configure X-Forwarded-For and X-Forwarded-Proto in v2? - Traefik / Traefik v2 (latest) - Traefik Labs Community Forum said I have to set
forwardedHeaders, but it confused me a lot. My kubernetes setup make sure traefik could get the real ip directly, so I just can't figure out which ip should I trust. And also why you need to trust some ip to make a middleware work? That makes no sense to me.