Mi piacerebbe conoscere l'url corrente con elisir/phoenix framework, come posso ottenere questo?Come ottenere l'url corrente nel framework phoenix
Modifica # 1:
Il mio file nginx config:
server {
client_max_body_size 100M;
listen 80;
server_name *.babysittingbordeaux.dev *.babysittingparis.dev
access_log /usr/local/var/log/nginx/baby-access.log;
error_log /usr/local/var/log/nginx/baby-error.log;
location/{
proxy_pass http://127.0.0.1:4000;
}
}
Codice:
Atom.to_string(conn.scheme) <> "://" <> (Enum.into(conn.req_headers, %{}) |> Map.get("host")) <> conn.request_path
Questo esempio restituisce http://127.0.0.1:4000/, vorrei ottenere http://www.babysittingbordeaux.dev/
Sono dentro modalità di sviluppo.
Si potrebbe mantenere l'intestazione originale nel server nginx proxy. '' location/{ proxy_pass http://127.0.0.1:4000; proxy_set_header Host $ host; } '' ' –
ma penso che se si esegue in modalità di produzione, uno degli altri metodi funzionerà. –
Amico, sei il migliore, ha funzionato! Grazie –