-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client IP address incorrect. How to set x-forwarded-for in Varnish 4? #24
Comments
Add these lines in your /etc/nginx/nginx.conf :
Source : http://linuxaria.com/article/how-to-log-the-correct-ip-having-varnish-and-nginx |
Oyabi, I already have that in my nginx.conf. I also have CloudFlare and have added all their proxies to the set_real_ip_from. The client's IP information is correct when I remove Varnish, and send from CloudFlare directly to Nginx. Only when I add Varnish, it seems that it is removing the X-Forwarded-For for the client's IP. |
I doesn't use CloudFare so it's will be difficult for me. Tell me if one of these solution works for you. =) |
Hi Kindnation, set_real_ip_from 127.0.0.1; #Put the Ip of your varnish/proxy here This will then restore correct visitor ip in nginx logs. |
When I use this Varnish default.vcl, it shows my nginx webserver's IP for the client's IP address. Can you add the X-Forwarded-For and client.ip so that Varnish sends the correct client IP?
The text was updated successfully, but these errors were encountered: