Proxy server, access to real IP

X-Forwarded-For information agent for the record, each through an agent (except anonymous proxy), the proxy server will be the source of the requested additional IP in X-Forwarded-For in

A request from the 4.4.4.4, header comprising a line

X-Forwarded-For: 1.1.1.1, 2.2.2.2, 3.3.3.3

1.1.1.1 Representative request is issued by, after three agents, a first layer is a 2.2.2.2, 3.3.3.3 is the second layer, and the source of this request is a third layer of IP4.4.4.4 agent

 

And X-Real-IP, generally only recording of the real client requesting the IP, the example above, if the configuration of the X-Read-IP, will be

X-Real-IP: 1.1.1.1

So, if there is only one agency, the value is the same as the two heads

 

request.getRemoteAddr () ip access if there is a proxy server to get the address of a proxy server

 

The code:

Published 21 original articles · won praise 9 · views 30000 +

Guess you like

Origin blog.csdn.net/a5552157/article/details/105045625