I'm using a Websocket server behind NGINX. Here is the part in the configuration file of nginx to achieve the result:
location /websocket/ {
proxy_pass http://localhost:8090;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 86400;
}
This is working very well, however I come across a problem for my usage: Nevertheless I am using X-Forwarded-For and X-Real-IP in headers sent to the server, I haven't found a way to get the real IP address.
The Connection.Ip property is set to 127.0.0.1 (localhost) and the Connection.HeadersResponse stringlist don't contain any X- value
So is there a way to get this information from each connection and how ?