login: root

varnish+nginx as backend and real IP

With default config nginx all IP addresses shows as localhost.
Here is configuration to show real client IP.

Snippet from varnish config:

Snippet from nginx config:

Comments (7)

  1. manuelv

    great !

    it ‘s work perfectly

    thks a lot

    Reply
  2. Amit Bhatia

    Thanks. Your method worked even when the other methods have failed to get the real ip.

    Reply
  3. steff

    works 100% thx!!1!

    Reply
  4. JANGSAN

    Where could I put these?

    set_real_ip_from 127.0.0.1;
    real_ip_header X-Real-ip;

    Reply
    1. nsc (Post author)

      it may be entered in three places according to Your configuration:
      http, server or location

      more info:
      http://wiki.nginx.org/HttpRealipModule

      Reply
  5. zillur

    For getting client ip in application like PHP, ASP visit getting-real-client-ip-through-varnish/

    Reply
  6. Javier Cubides F (@jcferrans)

    Thank you Sooooo muchhhh

    Reply

Leave a Reply

Close
%d bloggers like this: