Multiple issues with caching
-
Hi,
I’ve found multiple issues while using this plugin with heavily cached environment.
Server: LAMP with nginx, memcached, varnish & load balancer
WP: v3.6.1 with W3 Total Cache set up (page, db, object, browser, varnish cache enabled)First of all: Unique voting based on IP have problem because all votes were saved with internal IP from server. In this case $_SERVER[‘REMOTE_ADDR’] was always ‘127.0.0.1’. Every next user was blocked from rating after first vote on post.
Solution (not so ideal) – change:
$ip = $_SERVER['REMOTE_ADDR'];
to:
$ip = ''; if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { $ipForwarder = explode(', ', $_SERVER["HTTP_X_FORWARDED_FOR"]); $ip = $ipForwarder[0]; } else { $ip = $_SERVER["REMOTE_ADDR"]; }
Why not so ideal? Whole companies can have offices hidden after one IP. Is there possibility to add unique votes based on IP & cookies functionality in future?
Second thing: lack of action hooks in plugin functions. Please add at least action hook on resetting votes. I may want for example add ‘flush cache’ action after votes reset.
- The topic ‘Multiple issues with caching’ is closed to new replies.