title: Change phoenix endpoint url host at runtime
body: <p>Does anyone know of a way of changing the <code>:host</code> of the Phoenix application endpoint dynamically on every request?</p>
  
  <p>Specifically to support multiple domains on a single phoenix app, i want to change the host in the endpoint based on the host in the connection object.</p>
  
  <p>Am trying something on the lines of</p>
  
  <pre><code>conn = Map.get_and_update(conn.private.phoenix_endpoint[:url], :host, fn (_) -&gt; "ll.com" end)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>Keyword.put(conn.private.phoenix_endpoint.config(:url), :host, conn.host)
  </code></pre>
  
  <p>But am not quite correct.</p>