Welcome! Log In Create A New Profile

Advanced

get Real IP address of user in stream context

get Real IP address of user in stream context
June 28, 2016 01:36AM
Hi. I have this config
stream {
upstream web_server {
server 54.194.65.153.xip.io:443;
}
server {
listen 443;
#proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass web_server;
}
}

I want to get user real ip-address. But if I uncomment #proxy_set_header X-Forwarded-For $remote_addr; I see error

[emerg] "proxy_set_header" directive is not allowed here

How can I get user real ip? Thank you.
Re: get Real IP address of user in stream context
June 28, 2016 03:06AM
Looks like this is not yet supported, you can use https://github.com/openresty/stream-lua-nginx-module
and see if you can do something with headers.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 86
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready