我试图编辑default.vcl文件,以获得真正的客户端IP地址显示在我的WordPress的。 我发现这个在线,我读了很多页面,但没有使这项工作。 我正在使用varnish-4.0.1修订版4354e5e。
我把这个添加到VCL文件中,
sub vcl_recv { remove req.http.X-Forwarded-For; if (req.http.cf-connecting-ip) { set req.http.X-Forwarded-For = req.http.cf-connecting-ip; } else { set req.http.X-Forwarded-For = client.ip; } }
但是,此后,清漆服务无法启动。 当我回到默认的VCL文件时,一切又恢复正常了。 任何人都可以请帮我做这个工作? 我也使用Cloudflare btw。
你需要检查你的VCL对Varnish 4
https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html