-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
原始需求:使用 nginx 作为前置的服务器,用于处理和客户端的 HTTPS 连接,处理客户端的静态资源请求,并将 API 请求转发给 Onion 端口。 Nginx 配置参考:
server {
root /var/www;
location /api/ {
proxy_pass http://localhost:8080/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
真实的客户端 IP 被保存在 HTTP 头部名为 X-Real-IP 的变量里,因此获取 IP 的方法需要变更为如下,否则获取客户端的 IP 会为 127.0.0.1。
onion_request_get_client_description(req);
onion_request_get_header(req, "X-Real-IP");