Restore Real IP in Nginx Reverse Proxy

Compile Nginx with real ip module. The origin server will then be able to get the real ip address from the proxy server.

Origin Server:

Add the following into conf file. Put it inside server{} but outside location{}.

Proxy Server:

You can further secure the connection by only allowing proxy server to access origin server.

References:

  1. http://www.ttlsa.com/nginx/nginx-get-user-real-ip/
  2. http://www.nginx.cn/4646.html

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.