0

为了测试,我有一个简单的控制器来检查客户端的远程 IP 地址:

defmodule AppWeb.PageController do
  use AppWeb, :controller

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

    render conn, "index.html"
  end
end

在我的生产环境中使用 进行测试时phx.serverconn.remote_ip包含预期的客户端 IP 地址,格式如下:

{0, 0, 0, 0}

在运行使用 Distillery 打包的二进制文件时,conn.remote_ip会返回类似这样的内容,即使对于具有不同 IP 地址的多个远程客户端,它每次都会返回相同的内容:

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

我的应用程序没有坐在反向代理后面,那么还有什么可能导致这种情况发生?

4

0 回答 0