Does fly replace the inbound IP address for requests?

Does fly replace the inbound up address for requests? From what I’m seeing ipv4 addresses are being changed into ipv6. And it also appears that the ipv6 version does not map back to the original ipv4 address.

You’ll have to check the actual ip from the headers. I use this:

    x_real_ip = Plug.Conn.get_req_header(conn, "x-real-ip")
    fly_client_ip = Plug.Conn.get_req_header(conn, "fly-client-ip")
    cond do
      length(fly_client_ip) != 0 ->
        Plug.Conn.put_session(conn, :ip, Enum.at(fly_client_ip,0))
      length(x_real_ip) != 0 ->
        Plug.Conn.put_session(conn, :ip, Enum.at(x_real_ip,0))
      true ->
        Plug.Conn.put_session(conn, :ip, conn.remote_ip)
    end

Edit: Realized I didn’t answer your question. I’m pretty sure yes as it goes internally over ipv6 wireguard to the machine in question to serve the response.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.