remote_ip
remote_ip copied to clipboard
Parse X-Forwarded-Port and X-Forwarded-Proto
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.
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. 😛
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, 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.