"ngx.var.remote_addr" have different value when retrive it twice in lua

石磊 shilei at qiyi.com
Thu Aug 11 07:04:49 UTC 2016


I am using nginx 1.4, and I did fetch the "ngx.var.remote_addr" more than once in lua script, but strange thing is sometimes I will get different “$remote_addr” in different line in the same lua script file.
Some more information:

1.       I hook the lua script at rewrite_by_lua_file stage

2.       This happens when the client has more than one ip address with different Operators.

3.       The “remote_addr” I got are the ip addresses the client have from different Operators.

I want to know how this happen, it is by design that the “$remote_addr” could be changed for a http request?


石  磊


手机:+86 138 1180 3496
传真:+86 10 6267 7000
邮箱:shilei at qiyi.com<mailto:shilei at qiyi.com>
网址:www.iQIYI.com  www.ppstream.com<http://www.ppstream.com/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160811/ebb4714d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 25521 bytes
Desc: image001.jpg
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160811/ebb4714d/attachment.jpg>

More information about the nginx mailing list