Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 localhost 中运行服务127.0.01:8000
127.0.01:8000
我正在使用以下方法代理它:
proxy_pass http://127.0.0.1:8000;
问题是我需要将用户的 IP 地址传递给服务。
有任何想法吗?
我通过设置自定义标头将真实 IP 发送到 django:
proxy_set_header X-Real-IP $remote_addr;
这些标题可在request.META
request.META
见http://wiki.nginx.org/HttpRealIpModule