当前位置:网站首页>X-forwarded-for details, how to get the client IP
X-forwarded-for details, how to get the client IP
2022-07-06 15:46:00 【Empty one by one】
Let's start with the official definition
X-Forwarded-For
X-Forwarded-For (XFF) In the process of client accessing the server, if you need to go through HTTP Proxy or load balancing server , It can be used to obtain the information of the client that originally initiated the request IP Address , This news first became the de facto standard . When the message flow is intercepted from the client to the server , The server-side access log can only record the information of the proxy server or load balancing server IP Address . If you want to get the name of the client who originally initiated the request IP Address if , that X-Forwarded-For That's where it comes in .
This message header will be used for debugging and statistics , And generate customized content based on location , According to the design purpose , It will expose certain privacy and sensitive information , For example, the client's IP Address . So when applying the header of this message , The privacy of users needs to be taken into account .
HTTP In the agreement Forwarded It is the standardized version of the first part of this message .
X-Forwarded-For It is also the first used in an email related agreement , Used to indicate that an email was forwarded from another account .
| Header type | Request header |
|---|---|
| Forbidden header name | no |
grammar
X-Forwarded-For: <client>, <proxy1>, <proxy2> The specific links :X-Forwarded-For - HTTP | MDNX-Forwarded-For (XFF) In the process of client accessing the server, if you need to go through HTTP Proxy or load balancing server , It can be used to obtain the information of the client that originally initiated the request IP Address , This news first became the de facto standard . When the message flow is intercepted from the client to the server , The server-side access log can only record the information of the proxy server or load balancing server IP Address . If you want to get the name of the client who originally initiated the request IP Address if , that X-Forwarded-For That's where it comes in .https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/X-Forwarded-For
Let me use a picture to describe X-Forwarded-For Collection process

There are 6 A step , When a user initiates a website visit , in the light of x-forwarded-for The importance of 5 Nodes have been described ,
An example is user access www.baidu.com
① Convert home LAN to community LAN address , This is also a LAN , Just bigger ;
② Pass the LAN address of the community through SNAT Convert to public address :36.110.25.116;
2-3 Dns The service converts the target address of the access into a specific ip;
③ Network access equipment of the computer room where the accessed service is located ip:220.181.38.148;
④ after waf The server :105.16.35.100;
⑤ Request to reach the company LAN proxy server 101.25.48.201;
Finally, we arrive at the real business server Server. This time from Server Collected on the server X-Forwarded-For The address is as follows :
X-Forwarded-For: 36.110.25.116,220.181.38.148,105.16.35.100,101.25.48.201
client IP proxy-ip proxy-ip proxy-ip
Reference resources
X-Forwarded-For and X-Real-IP The difference between ? - Pig Ah Mei - Blog Garden
边栏推荐
- Report on the market trend, technological innovation and market forecast of printing and decorative paper in China
- Research Report on surgical fluid treatment industry - market status analysis and development prospect prediction
- 力扣刷题记录
- Accounting regulations and professional ethics [2]
- 通俗地理解什么是编程语言
- Cost accounting [24]
- Cost accounting [14]
- 【高老师UML软件建模基础】20级云班课习题答案合集
- 【练习-9】Zombie’s Treasure Chest
- Research Report on printed circuit board (PCB) connector industry - market status analysis and development prospect forecast
猜你喜欢

STM32 how to use stlink download program: light LED running light (Library version)

STM32学习记录:玩转按键控制蜂鸣器和LED

STM32如何使用STLINK下载程序:点亮LED跑马灯(库版本)

洛谷P1102 A-B数对(二分,map,双指针)

STM32 learning record: play with keys to control buzzer and led

【练习-5】(Uva 839)Not so Mobile(天平)

信息安全-威胁检测-NAT日志接入威胁检测平台详细设计

Gartner:关于零信任网络访问最佳实践的五个建议

Matlab example: two expressions of step function

Learning record: Tim - capacitive key detection
随机推荐
Research Report on pharmaceutical R & D outsourcing service industry - market status analysis and development prospect forecast
Learning record: Tim - capacitive key detection
毕业才知道IT专业大学生毕业前必做的1010件事
FSM and I2C experiment report
ucore lab 6
【练习-8】(Uva 246)10-20-30==模拟
ucorelab4
Optimization method of path problem before dynamic planning
Accounting regulations and professional ethics [5]
Research Report on market supply and demand and strategy of Chinese hospital cleaning chemicals industry
ucore lab5
X-Forwarded-For详解、如何获取到客户端IP
Cost accounting [19]
0 - 1 problème de sac à dos (1)
Flink 使用之 CEP
Eslint--- error: newline required at end of file but not found (EOL last) solution
Opencv learning log 31 -- background difference
nodejs爬虫
Interesting drink
学习记录:USART—串口通讯