Opened 6 years ago
Last modified 13 months ago
#1936 closed defect
'set_real_ip_from' in location section is not processed before REWRITE_PHASE — at Version 1
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | nginx-module | Version: | 1.17.x |
| Keywords: | realip_module | Cc: | |
| uname -a: | |||
| nginx -V: | 1.17.8 | ||
Description (last modified by )
For the confuguration
server {
listen 1024 proxy_protocol;
location / {
real_ip_header proxy_protocol;
set_real_ip_from 0.0.0.0/0;
return 200 remote_addr=$remote_addr;
}
}
response on request
echo -en "PROXY TCP4 4.4.4.4 5.5.5.5 1234 80\r\nGET / \n\n" | nc -q-1 0 1024
is
remote_addr=127.0.0.1
It is wrong address. The same in the access log.
Moving real_ip* directives into the server section or removing 'return' provide the correct result.
server {
listen 1024 proxy_protocol;
real_ip_header proxy_protocol;
set_real_ip_from 0.0.0.0/0;
location / {
return 200 remote_addr=$remote_addr;
}
}
remote_addr=4.4.4.4
This happens due to missing call of ngx_http_realip_handler() with config of a location on PREACCESS_PHASE.
Because 'return' works off on REWRITE_PHASE.
Note:
See TracTickets
for help on using tickets.
