1 message in ru.sysoev.nginxrealip module trouble
FromSent OnAttachments
Michał JaszczykJan 26, 2009 6:39 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:realip module troubleActions...
From:Michał Jaszczyk (jasi@gmail.com)
Date:Jan 26, 2009 6:39:43 am
List:ru.sysoev.nginx

Hi guys,

I'm having some trouble using realip module. My case is rather simple, so I hope you can help me figure it out :).

My Nginx is accessed either directly by clients or via a proxy. In either case I'd like to see client's IP in the logs. So I used the realip module and put this into my config file:

set_real_ip_from 10.60.1.120; real_ip_header X-Forwarded-For;

It works but not in all cases:

- If I access Nginx directly and don't put any X-Forwarded-For header, I see correct IP in the log file. - If I access Nginx directly and put a fake X-Forwarded-For header, Nginx ignores it and puts correct IP in the log file. - If I access Nginx via proxy and don't put any X-Forwarded-For header, I see correct IP in the log file - Nginx reads the X-Forwarded-For header set by my proxy. - If I access Nginx via proxy and put a fake X-Forwarded-For header, the IP in the log file is not correct. My proxy simply adds another header, so there are two X-Forwarded-For headers in the request and Nginx seems to take the first one, not the last.

I read previous posts about this issue, but I'm using Nginx 0.7.31 and I can't apply previous solutions.

Regards,

Mike