Hey!
I try to create black list for ip in my Phoenix app, I already have DB and function to check is ip in black list or not. What is the right way to do it?
If i try plug
def ip_check(conn, _opts) do
real_ip = Helpers.ip_to_str(conn.remote_ip)
conn =
if is_ip_blocked?(real_ip) do
conn |> halt()
else
conn
end
IO.inspect(conn)
conn
end
on connection i get exception
[debug] Phoenix.Router halted in :browser/2
[error] #PID<0.707.0> running Phoenix.Endpoint.SyncCodeReloadPlug (connection #PID<0.706.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /
** (exit) an exception was raised:
** (Plug.Conn.NotSentError) a response was neither set nor sent from the connection