I want to get the IP adress of the client that visits my page. My app is running behind a proxy so i set this configuration to my nginx file:
proxy_set_header X-Forwarded-For $remote_addr;
Now i try to get the IP adress like this in express
req.ip
req.headers["x-forwarded-for"]
req.ips
req.connection.remoteAdress
Nothing seems to work. I also set trust proxy to true
app.set("trust proxy", true);
But the other configuration like proxy_set_header Host
or proxy_set_header Connection "upgrade"
are working. What am i doing wrong?