The browser can access the page because by default it is allowed to cache the response. If you want to prevent this, you need to set the appropriate HTTP headers on pages that require authentication, on this similar issue :
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
You can do it in plug
defmodule MyApp.PreventCaching do
import Plug.Conn
def init(options) do
options
end
def call(conn, _opts) do
conn
|> put_resp_header(conn, "cache-control", "no-cache, no-store, must-revalidate")
|> put_resp_header(conn, "pragma", "no-cache")
|> put_resp_header(conn, "expires", "0")
end
end
( ) ,
plug MyApp.PreventCaching