remote_ip icon indicating copy to clipboard operation
remote_ip copied to clipboard

Parse X-Forwarded-Port and X-Forwarded-Proto

Open edevil opened this issue 7 years ago • 3 comments

Besides the real client IP there are other headers that are also interesting to parse such as the real remote port and protocol used. This is useful in situations in which the proxy is terminating the SSL for you.

edevil avatar Aug 04 '17 14:08 edevil

This would be a nice to have, but I'm not sure it's really in the scope of this plug. At least the name would be misleading. 😛

ajvondrak avatar Feb 01 '19 16:02 ajvondrak

Plug.SSL is capable of rewriting the other headers, but it also forces a redirect to HTTPS, which I don't want because it's causing problems with my load balancer's health checks (that don't include X-Forwarded-Proto)

ericlathrop avatar Apr 27 '20 17:04 ericlathrop

@ericlathrop, you can add your load balancer's IP to :excluded list (https://github.com/elixir-plug/plug/blob/master/lib/plug/ssl.ex#L47) to prevent redirection. I'm using that on Kubernetes with pod IP and node IP in the exclusion list.

almirsarajcic avatar Jun 08 '20 07:06 almirsarajcic