Forum: NGINX Reading from variable in config file

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Roman M. (Guest)
on 2009-05-06 18:07
Hi all,
I need to read client's IP to store it in module context:

{ ngx_string("real_ip"),
        offsetof(ngx_http_my_loc_conf_t, realIp),
        NULL },

and in config file:
real_ip $proxy_add_x_forwarded_for;

but then it stores not value, but value's name
($proxy_add_x_forwarded_for). This line is put in the same location

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

is, which works fine, so client's ip must be there :)

Or there is mayby another way to get $proxy_add_x_forwarded_for from
inside of my module?

thanks in advance,
Roman M. (Guest)
on 2009-05-13 16:00
IP is stored in r->connection->addr_text as shown in method that sets
variable x-forwarded-for
This topic is locked and can not be replied to.