• Resolved nicksnels

    (@nicksnels)


    Since yesterday I can no longer log in to the dashboard of my WordPress sites. I can log in the main site. But when I go from the main site to the dashboard of another site of the multisite setup, I get a login screen. When I log in I get the error:
    ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

    I am using WordPress 3.8. It runs behind Varnish, maybe that is causing it. I have already overwritten the wp-login.php file. I have network disabled all the plugins. The only thing that temporarily helped was adding the following to wp-config.php:

    define(‘ADMIN_COOKIE_PATH’, ‘/’);
    define(‘COOKIE_DOMAIN’, ”);
    define(‘COOKIEPATH’, ”);
    define(‘SITECOOKIEPATH’, ”);

    I could then go to the dashboard of the other site without needing to enter my log in details. However when I commented the above lines the same error occurred.

    BTW I do not have cookies disabled. I tried it in IE, Firefox and Chrome. All the same issue.

    Does anybody know a solution? Thanks.

    Kind regards,

    Nick

Viewing 11 replies - 1 through 11 (of 11 total)
  • Varnish works well partly because it removes all cookies. Unless your Varnish VCL says to not remove cookies from wp-admin related requests it will and this may be your problem. Can you post to a pastebin with your VCL? It’s typically found in /etc/varnish/default.vcl.

    sub vcl_recv {
          # Drop any cookies sent to WordPress.
          if ( ! ( req.url ~ "wp-(login|admin)" ) ) {
          unset req.http.cookie;
    }
    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    If you don’t know your VCL, who’s your host? 🙂

    Thread Starter nicksnels

    (@nicksnels)

    You can find my default.vcl file at http://pastebin.com/VYeXR1vC . I have added

    sub vcl_recv {
          # Drop any cookies sent to WordPress.
          if ( ! ( req.url ~ "wp-(login|admin)" ) ) {
          unset req.http.cookie;
    }

    But those lines didn’t solve the problem. I still get the same error.

    BTW everything runs on a dedicated server which I manage.

    Can you take Varnish out of the setup temporarily and see if it works then?

    Thread Starter nicksnels

    (@nicksnels)

    If you know of a way to make a multisite setup work on a port other than 80. When I access the sites on the 4040 port, I get a message stating that a multisite setup only works on port 80. Otherwise I won’t be able to disable Varnish as more sites rely on it.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Thread Starter nicksnels

    (@nicksnels)

    I’m doubting that my problem is Varnish related. The rules drop cookies except from the wp-login and wp-admin pages. Without these rules cookies are not dropped. Right? So how can this explain the problems I’m having?

    BTW these rules don’t work well when you have other sites that are not running on WordPress behind Varnish as this rule strips all rules except for wp-login and wp-admin pages.

    Without these rules cookies are not dropped.

    Correct, without that rule Varnish does not drop the cookies and when Varnish smells cookies it caches nothing. I have several Varnish backends running to serve sites and I haven’t had this problem.

    However, it’s easier to solve the problem if you take Varnish out of the picture.

    I think I see your post on StackOverflow.

    Thread Starter nicksnels

    (@nicksnels)

    @patrick, yes indeed that is my post on StackOverflow.

    I have found a work around for my problem but I do not know whether or not it has any site effects. I have added a line to my wp-config.php file:

    define(‘COOKIE_DOMAIN’, ”);

    When I now switch to the dashboard of another domain (FQDN), I get the login screen, once logged in I stay logged in after switching back and forth from dasboards from several domains.

    What effects does setting COOKIE_DOMAIN to an empty string have?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Nothing bad. It’s basically saying not to set them explicetly for a domain, which is … a weird problem to have.

    make sure that you have defined correct domain on your wp-config.php :
    define('DOMAIN_CURRENT_SITE', 'yourmainsite.com');

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Unable to login in to dashboard of WordPress 3.8 in multisite setup’ is closed to new replies.