Admin-Ahead Community

General Category => General Discussion => Topic started by: sajugovind on March 16, 2014, 07:32:22 pm

Title: "Cookies are blocked or not supported by your browser. " Wordpress error
Post by: sajugovind on March 16, 2014, 07:32:22 pm
Since updating WP, When users attempt to login to my WP site, they receive an error message:

"Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress."

Cookies are enabled, and if you re-enter your login information on the same page with the error, you can access the site without difficulty. You will then never see the message if you logout and login , unless you clear your cookies, then it returns.


Solution:



First of all, how to get logged in again. Comment out lines 744-746 in wp-login.php . It should look like this:

Code: [Select]
// if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
// $user = new WP_Error('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
// else
$user = wp_signon('', $secure_cookie);

This will bypass the check entirely and logs you in.

At first I didn't understand why it might fail, but then I remembered I am running behind a Varnish cache which filters out all but some select cookies. I haven't checked, but I am fairly certain that my Varnish setup filters out the WordPress test cookie when it receives the login request (the actual POST with the login data). Is it possible all of you are running behind a proxy which filters cookies?

This is pretty sloppy by the WordPress team. They could also just test the session cookie. If THAT one doesn't get through, it will fail anyway. Completely breaking when a test cookie is missing should not happen.