Skip to content

Commit 5fd33b1

Browse files
committed
Fix remote IP resolution
1 parent 7488cb2 commit 5fd33b1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

platform/lib/platform_web/plugs/remote_ip.ex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ defmodule PlatformWeb.Plugs.RemoteIp do
99
remote_ip =
1010
case get_req_header(conn, "fly-client-ip") do
1111
[val] -> val
12-
_ -> to_string(:inet_parse.ntoa(conn.remote_ip))
12+
_ -> case conn.remote_ip do
13+
x when is_binary(x) ->
14+
# If it's already a string, use it directly
15+
x
16+
x when is_tuple(x) ->
17+
# Convert tuple to string representation
18+
:inet.ntoa(x) |> to_string()
19+
end
1320
end
1421

1522
Logger.metadata(remote_ip: remote_ip)

0 commit comments

Comments
 (0)