[] Nnginx get multi-tier Web proxy client source IP

Header Head:
X-Real-the IP-(custom, non-standard)
X-Forwarded-the For-(extended definition, has become standard)

Nginx variable:
$ REMOTE_ADDR: Client Address
$ proxy_add_x_forwarded_for: X-Forwarded-For Header header REMOTE_ADDR plus $
$ HTTP_X_FORWARDED_FOR: the X-Forwarded-the For-header Header

Anti-generation Nginx add the following settings:
proxy_set_header the X-Real-IP-$ REMOTE_ADDR;
proxy_set_header the X-Forwarded-the For-$ proxy_add_x_forwarded_for;

Examples:
A-> the B-> the C-> D
A for the client, B and C for the generation of anti Nginx, D is the server

When A accesses B, X-Forwarded-For blank, A $ REMOTE_ADDR of the IP, it is incidental to the forwarding B C Header head X-Forwarded-For IP A, namely;
when B accesses C, X-Forwarded- for as IP, $ remote_addr a for IP B, and C at this time is forwarded to the IP D incidental header X-forwarded-for header is the a and IP B's;
when accessing C D, D you can get C came the X-Forwarded-For Header head analyzes the source IP.

Guess you like

Origin www.cnblogs.com/20190119-tl/p/11529574.html