Hey all,
I’m running into an issue when attempting to get the client’s ip address on AWS. My application is running behind a network load balancer, which seems to not set the X-Forwarded-For header. It looks like there is an option to enable Proxy protocol v2 within the target group, but this looks like a binary protocol which needs to be parsed. Has anyone dealt with this before? Has anyone written a decoder for this protocol?
2 Likes
There is some work done by Heroku on Ranch. (Phoenix depends on Cowboy, which depends on Ranch)
This is the result: https://hex.pm/packages/ranch_proxy_protocol
It seems like there is however no easy way to integrate this into cowboy / phoenix.
the classic ELB seems to set x-forwarded-for, according to docs anyway - about to attempt to use it myself.
Have the same issue behind an ELB, that client_ip is that of the load balancer…
https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html