简体   繁体   English

端口转发时找不到请求IP地址

[英]Unable to find request IP address when port forwarding

Unable to find request IP address when port forwarding端口转发时找不到请求IP地址

Example :例子 :

My Laptop Call > Jump Server Call >> The Web Server My Laptop Call > Jump Server Call >> The Web Server

At the Web Server the request ip will be every time the jump server ip在 Web Server 请求 ip 将是每次跳转服务器 ip

How to know the real ip that is call the Web Server in my case is My laptop not the Jump Server如何知道在我的情况下调用 Web 服务器的真实 IP 是我的笔记本电脑而不是 Jump Server

使用它来获取 IP 地址

let ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress

If your jump server acts as a proxy you might want to check to X-FORWARDED-FOR header.如果您的跳转服务器充当代理,您可能需要检查 X-FORWARDED-FOR 标头。

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM