After walking over largely uncharted terrain for some good time I arrived at the point where I have a phoenix application and all its dependencies containerised in a docker container, exposing unix socket, to which the rev-proxy (nginx) connects from outside the container. All nice, except that I have no idea how to get the original request IP recognised by the application. When configuring Phoenix Endpoint to use unix socket, the configuration as described here is {:local, path}
tuple and the application âseesâ the IP as local
rather than any address. Nginx can easily be configured to add some headers with orginal IP but is there a way to pass that information down to Phoenix application?
The remote_ip
plug is a good place to start, assuming youâve got nginx sending the right headers.
IIRC itâs not built-in because itâs only safe to trust those headers behind a correctly-configured proxy.
2 Likes
Yes, this works - TNX!