Im using an ETS table to store sessions. The Cookie is not used to when accessing the ETS table. How do I prevent the set-cookie header from being sent?
This has no effect:
defmodule Session.RemCookies do
import Plug.Conn
def init(opts), do: opts
def call(conn, _opts) do
register_before_send(conn, fn conn ->
# Remove all Set-Cookie headers from response
%{conn | resp_headers: Enum.reject(conn.resp_headers, fn {key, _} ->
String.downcase(key) == "set-cookie"
end)}
end)
end
end
Even if you have the session stored in ETS, you still need to store the session key as a cookie. Otherwise, how does your application tell which session to use for incoming request?
If you have a common host and the services are all subdomains then a wildcard cookie could do the trick and circumvent the problem you mentioned above.