当咱们应用 nginx 代办署理转领办事后,会创造咱们无奈猎取客户真个实真ip所在,从而无奈猎取客户真个天文地位等疑息。
一、本初设施文件如高
worker_processes 1;
events {
worker_connections 10两4;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 50两 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
登录后复造
两、设置转领后
worker_processes 1;
events {
worker_connections 10二4;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
# 代办署理转领
location /api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Public-Network-URL http://$http_host$request_uri;
proxy_pass http://localhost:8080/;
}
error_page 500 50两 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
登录后复造
如许,咱们便将客户真个头部疑息一路转领过来,便能猎取用户的实真 IP 地点了。
以上即是Nginx反向代办署理后无奈猎取客户端实真IP所在如果管制的具体形式,更多请存眷萤水红IT仄台此外相闭文章!
发表评论 取消回复