[PATCH] Adds $orig_remote_addr in realip module

Maxim Dounin mdounin at mdounin.ru
Mon Jun 8 00:32:13 UTC 2015


On Sat, Jun 06, 2015 at 08:46:07AM -0500, Jon Nalley wrote:

> Hi,
> I saw Ruslan's comments and responded (hoping to get a better
> understanding of the problem).
> http://mailman.nginx.org/pipermail/nginx-devel/2015-May/006974.html
> I had assumed that the issue with my prior patch was assigning the
> pointer from the context rather than copying the data.

Your assumption was wrong.  The problem is simple: you can't use 
contexts as long as stored data must survive internal 

Try logging your variable and check how it works for requests to 
index files, in a configuration like this:

    log_format test "remote_addr:$remote_addr orig:$orig_remote_addr";
    access_log /dev/stderr test;


    location / {
        index index.html;
        # assuming index.html exists

You'll see it won't work with requests to "/", since an internal 
redirect to "/index.html" happens and clears module contexts.

Maxim Dounin

More information about the nginx-devel mailing list