Does anyone know a way to change the :hostendpoint of a Phoenix application dynamically with every request?
In particular, in order to support multiple domains in a single phoenix application, I want to change the host at the endpoint based on the host in the connection object.
Try something in the lines
conn = Map.get_and_update(conn.private.phoenix_endpoint[:url], :host, fn (_) -> "ll.com" end)
or
Keyword.put(conn.private.phoenix_endpoint.config(:url), :host, conn.host)
But I'm not quite right.
source
share