nps icon indicating copy to clipboard operation
nps copied to clipboard

nginx下使用https无法获取真实ip,而http可以

Open evilkong opened this issue 3 years ago • 3 comments

Describe the bug NPS/C版本:0.26.10 服务器环境:nginx+phpfpm

在nps.conf中设置http_add_origin_header=true之后, 在配置网站分别支持http和https情况下,利用php打印$_SERVER。 通过http访问时,能成功获取到HTTP_X_REAL_IP和HTTP_X_FORWARDED_FOR。 而通过https访问时,打印信息没有这两个的字段和值。

两者的REMOTE_ADDR均为NPC所在服务器上的ip。

目前网站被大量无谓的信息扫网和尝试攻击,不安全的同时还浪费带宽流量,恳请作者大大帮忙解决。谢谢

evilkong avatar Dec 10 '21 15:12 evilkong

我来说说吧,因为https是加密通信,只有在nps负责ssl的时候,才能搞定 HTTP_X_FORWARDED_FOR。 其实大部分场景都是http_proxy_only下的场景。 https无法获取真实ip,对于nps来讲,对于开源免费的nps这类好东东来讲,实现起来略复杂了。

uuleaf avatar Jan 02 '22 01:01 uuleaf

https://ehang-io.github.io/nps/#/description?id=%e8%8e%b7%e5%8f%96%e7%94%a8%e6%88%b7%e7%9c%9f%e5%ae%9eip

dyp8848 avatar Feb 22 '22 09:02 dyp8848

解决了吗,大哥

ac-sc avatar Dec 23 '23 02:12 ac-sc