当前位置:网站首页>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
边栏推荐
- Research Report on market supply and demand and strategy of China's medical chair industry
- 想应聘程序员,您的简历就该这样写【精华总结】
- Learning record: Tim - Basic timer
- Eslint--- error: newline required at end of file but not found (EOL last) solution
- Opencv learning log 18 Canny operator
- Research Report on market supply and demand and strategy of Chinese hospital cleaning chemicals industry
- C 基本语法
- Accounting regulations and professional ethics [3]
- Cost accounting [14]
- MATLAB综合练习:信号与系统中的应用
猜你喜欢
【高老师软件需求分析】20级云班课习题答案合集
Learning record: use STM32 external input interrupt
STM32如何使用STLINK下载程序:点亮LED跑马灯(库版本)
信息安全-威胁检测-NAT日志接入威胁检测平台详细设计
学习记录:串口通信和遇到的错误解决方法
Stm32 dossiers d'apprentissage: saisie des applications
UCORE Lab 1 system software startup process
ucore lab 6
学习记录:TIM—基本定时器
毕业才知道IT专业大学生毕业前必做的1010件事
随机推荐
Accounting regulations and professional ethics [2]
Market trend report, technical innovation and market forecast of lip care products in China and Indonesia
C语言是低级和高级的分水岭
China chart recorder market trend report, technology dynamic innovation and market forecast
C 基本语法
China's peripheral catheter market trend report, technological innovation and market forecast
cs零基础入门学习记录
Ball Dropping
STM32学习记录:LED灯闪烁(寄存器版)
Market trend report, technical innovation and market forecast of geosynthetic clay liner in China
Matlab example: two expressions of step function
【练习4-1】Cake Distribution(分配蛋糕)
China's earthwork tire market trend report, technical dynamic innovation and market forecast
Cost accounting [14]
Opencv learning log 16 paperclip count
Research Report on pharmaceutical R & D outsourcing service industry - market status analysis and development prospect forecast
STM32如何使用STLINK下载程序:点亮LED跑马灯(库版本)
C语言学习笔记
区间和------离散化
Es6--- two methods of capturing promise status as failed