How to pass the remote IP to a proxied service? - Nginx

前端 未结 2 2058
青春惊慌失措
青春惊慌失措 2020-12-17 17:21

I\'m running a service in localhost at 127.0.01:8000

and I\'m proxying this by using:

proxy_pass http://127.0.0.1:8000;
<
相关标签:
2条回答
  • 2020-12-17 17:29

    I send the real IP to django by setting a custom header:

    proxy_set_header X-Real-IP $remote_addr;

    Those headers are available in request.META

    0 讨论(0)
  • See http://wiki.nginx.org/HttpRealIpModule

    0 讨论(0)
提交回复
热议问题