Forum: NGINX Reading from variable in config file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A8385ab7ecd0bdced58543d8341ec8cd?d=identicon&s=25 Roman Mobczynski (mobczynski)
on 2009-05-06 16:07
Hi all,
I need to read client's IP to store it in module context:

{ ngx_string("real_ip"),
        NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
        ngx_conf_set_str_slot,
        NGX_HTTP_LOC_CONF_OFFSET,
        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
where

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,
mobczynski
A8385ab7ecd0bdced58543d8341ec8cd?d=identicon&s=25 Roman Mobczynski (mobczynski)
on 2009-05-13 14: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.