Elixir/Distillery: Remote IP Address Isn't Accurate In Deployed Applications

178 Views Asked by At

For testing, I have a simple controller to inspect the client's remote IP address:

defmodule AppWeb.PageController do
  use AppWeb, :controller

  def index(conn, _params) do
    IO.inspect conn.remote_ip

    render conn, "index.html"
  end
end

While testing in my production environment with phx.server, conn.remote_ip contains the expected client IP address, which is in this format:

{0, 0, 0, 0}

While running the binary packaged with Distillery, conn.remote_ip returns something like this instead, even for multiple remote clients with different IP addresses, it returns the same thing every time:

{0, 0, 0, 0, 0, 12345, 12345, 12345}

My application isn't sitting behind a reverse proxy, so what else might be causing this to happen?

0

There are 0 best solutions below