
5

怎么获取客户端真实的ip为
source link: https://www.oschina.net/question/3644756_2324989
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

怎么获取客户端真实的ip为
请教一下,获取客户端真实ip为什么是这个逻辑顺序,首先获取x-forward-ip 而不是直接Proxy-Client-IP
01/28 16:30
回复
@jackfaye : 用 request.getRemoteAddr() 获取ip,当前面有反向代理时增加tomcat配置 <Valve className="org.apache.catalina.valves.RemoteIpValve" protocolHeader="X-Forwarded-Proto"/> 让tomcat将真实ip放在remoteAddr里面
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK