elixir - Record real IP address on using phoenix in the nginx upstream -


i have upstreaming phoenix app, that:

upstream my_app {     server localhost:3001; }  server {     root /var/www/my_app/priv/static;     listen 80;      location / {         proxy_pass http://my_app;     } } 

i want track real ip address, don't know how via standard phoenix conn.remote_ip because return 127.0.0.1 (because nginx proxies query phoenix). how can fetch real ip address?

there x-forwarded-for header designed that!

# nginx proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;  # phoenix conn.get_req_header(conn, "x-forwarded-for") 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -