• I have recently setup a fresh blank WP 3.9.1 environment on LAMP. All working fine including permalinks.

    Have enabled Multisite with sub-domain choice. All working just fine although I did had to define the following as Multisite as I was having the eternal loop of death that is documented elsewhere.

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

    I then enabled Google Apps Login plugin and managed to get that all working for my main site and sub-sites. Logins all authenticate using Google now. Brilliant.

    Next challenge domain mapping to the 2 other sites I have created.

    As soon as I enabled the domain mapping plugin, e.g the sunrise.php file (which is here in the wp-config.php file) it all goes wrong.

    define(‘WP_ALLOW_MULTISITE’, true);
    define(‘MULTISITE’, true);
    define(‘SUBDOMAIN_INSTALL’, true);
    define(‘DOMAIN_CURRENT_SITE’, ‘dev-domain.uk’);
    define(‘PATH_CURRENT_SITE’, ‘/’);
    define(‘SITE_ID_CURRENT_SITE’, 1);
    define(‘BLOG_ID_CURRENT_SITE’, 1);

    /* That’s all, stop editing! Happy blogging. */

    /** Absolute path to the WordPress directory. */
    if ( !defined(‘ABSPATH’) )
    define(‘ABSPATH’, dirname(__FILE__) . ‘/’);

    /* define(‘SUNRISE’, ‘on’); */

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . ‘wp-settings.php’);

    From that point onwards I’m unable to login/logout properly from every domain/link etc. The main issue although it can vary is you cannot logout of the ‘network’ domain URL’s.

    When you then clear the cookies you can’t get back in to the ‘network’ domain URL’s without commenting the sunrise.php file.

    Some more details
    <VirtualHost *:80>
    ServerAdmin email@some.org.uk
    DocumentRoot /var/www/html/essex/wordpress
    ServerName www
    ServerAlias dev-domain.uk *.dev-domain.uk
    <Directory /var/www/html/essex/wordpress>
    AllowOverride Fileinfo Options
    </Directory>
    # Logging
    ErrorLog /var/log/httpd/wordpress-error-log
    CustomLog /var/log/httpd/wordpress-access-log common
    </VirtualHost>

    I’ve replaced the real emails and domain names for privacy reasons.

    Can you please help me get this working. Let me know of any details you need.

    Look forward to the correct configuration I should have in place.

    Thanks
    Robin Cotgrove

    https://wordpress.org/plugins/wordpress-mu-domain-mapping/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Ron Rennick

    (@wpmuguru)

    If you want to use domain mapping you should not have any of the following defined in your wp-config.php

    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIE_DOMAIN', '');
    define('COOKIEPATH', '');
    define('SITECOOKIEPATH', '');
    Thread Starter rcotgrov

    (@rcotgrov)

    Removed those. Now I can’t login to main ‘network site’. I can login/logout of the ‘domain mapped’ sites.

    I open the URL
    http://dev-domain.uk/wp-login.php

    Click the Google Login, it validates the Google authentication (this work’s fine), the redirect URI from Google is setup and working fine too. No error there. The URL below appears briefly

    https://accounts.google.com/ServiceLoginAuth

    Login with Google ID/Password. Accepted. All good… Then the login box remains (e.g a loop) which was way I set those domain cookie values.

    The following URL is left in the address bar and you are not allowed into the admin areas of the main site / network.

    http://dev-domain.uk/wp-login.php?redirect_to=http%3A%2F%2Fdev-domain.uk%2Fwp-admin%2F&reauth=1

    Does this URL look correct ?

    What do you think could be occuring ?

    Thread Starter rcotgrov

    (@rcotgrov)

    Just tried the environment on Internet Explorer and all appears to be working for both ‘network’ and domain mapped sites.

    Issue look’s like a Google Chrome issue. Could this have anything to do with www vs non www ?

    Thread Starter rcotgrov

    (@rcotgrov)

    Clearing the Google Chrome browser content and cookies and restarting the browser provides this message when logging into the main ‘network’ domain URL.

    Session mismatch – try again, but there could be a problem setting cookies

    This only occurs when using Google Chrome (Windows). Will have someone test on Mac later.

    Thread Starter rcotgrov

    (@rcotgrov)

    I have ironed out a few problems and only have 1 main issue now which is you cannot login to the main domain ‘network’ site in Google Chrome.

    My site works absolutely fine across the non mapped and mapped domain sites now when using Internet Explorer.

    I have done some more digging into this problem. It’s down to cookies not being set in a Chrome Browser and I can’t work out why yet.

    I can see that the sunrise.php sets the COOKIE_DOMAIN correctly to dev-domain.uk and dev.mappeddomain.com etc… but when using Chrome the cookie is rejected by Google Chrome.

    Google Chrome developer console says for the ‘domain mapped’ sites the cookie domain and path are N/A but the stored cookies when you look at them do have the domain set properly so that transfers through just fine. The “wordpress_test_cookie” has a leading dot and the wp-settings-time-8 doesn’t have a leading dot. Is that normal ?

    The problem remains of the non-mapped domain being dev-domain.uk (one dot in it’s domain name. Is that significant??) is being rejected by Google Chrome ?

    Plugin Author Ron Rennick

    (@wpmuguru)

    Login with Google ID/Password.

    I have never used this with WP so I’m not going to be able to offer you any insight into the issues you are having/

    Thread Starter rcotgrov

    (@rcotgrov)

    I have deactivated the google plugin and the problem remains. Cookies are being rejected by Chrome.

    Thread Starter rcotgrov

    (@rcotgrov)

    I have deactivated the google plugin and the problem remains. Cookies are being rejected by Chrome.

    Plugin Author Ron Rennick

    (@wpmuguru)

    That’s a problem with chrome (quite possibly because you set a flag in the browser by using the Google login plugin).

    This plugin has ~250K downloads in its history & this is the first instance I’ve heard of where a browser was rejecting cookies.

    Thread Starter rcotgrov

    (@rcotgrov)

    Excellent. I’ll do a fresh clean install without Google apps plugin and confirm you are right.

    Thread Starter rcotgrov

    (@rcotgrov)

    I’ve cracked the problem but don’t know why Google Chrome is behaving in the way it is.

    The issue is with the domain name format I am using. I am using a new .UK style domain which doesn’t include the .org or .co bit… etc…

    domain.uk

    Released June 10th in the UK by Nominet. I setup the site with this new format Domain to start with and had the problems

    Google Chrome does not like this type of domain in accepting cookies, possibly because it thinks you can’t have a cookie from a TLD ????? I think Chrome isn’t realising this domain.uk is now valid for hosting websites. I’m amazed I can’t find any reference on the Net about this bug. Perhaps someone else can find it for me ?

    I did a fresh install of both domain.uk and domain.org.uk with WP3.9.1 and a fresh clean DB. No plugins installed nor enabled. Simply enabled Multisite with Sub-domain install and after logging out it all went wrong….

    If you setup wordpress & the ‘network’ on domain.uk Chrome would reject the cookies being sent.

    If you setup wordpress & the ‘network’ on domain.org.uk Chrome worked absolutely fine.

    Internet Explorer would always work no matter which domain type you used in the MU setup. I think I have discovered a bug in Google Chrome therefore. It’s not the first time apparently. I believe it used to not like NHS.UK as a domain when that was released.

    The workaround here will not be suitable as a fix
    http://tommcfarlin.com/resolving-the-wordpress-multisite-redirect-loop/

    because it’s incompatible with Domain Mapping because you mustn’t set COOKIE_DOMAIN

    I’m wondering how many other people are confusing the real root cause the cookies are being rejected is due to browser interpretation of the Cookie RFC’s etc…

    So, try an alternative domain name is my advice for anyone who hits this problem.

    I suppose I’m going to throw my hat in here as well. I too am/was having issues logging into a network mapped domain different from the main domain. My situation is very very similar to the OP.

    The ONLY way I could get into the main domain (which is domain.name) was to set the define('SUBDOMAIN_INSTALL', false). I got the cookie set then set it back to true. Now that the cookie is set I can’t logout – because the cookie isn’t getting unset nor can I get into any admins inside the network with different domains.

    So while it may not be the domain mapping plugin it manifests itself with it enabled.

    P.s. this work around ONLY works for the main network domain NOT the other domains that are mapped. This isn’t just a Chrome issue either. It’s exhibiting the same response in Safari.

    Thankfully I came across this post as I was facing the same problem with Chome having issues. However my problems stem’d from getting looping on the additional mapped domains at this time.

    However the key thing seems to be the primary domain for the base wordpress installation is a new .UK domain.

    The additional domains i’ve setup are .co.uk however the troubles are only in chrome, if i load the additional domains in any other browser the whole network works perfectly.

    Hopefully this gets resolved quickly from Chome but I think for the time being we are going to have to change away from using our .uk for the primary domain.

    Thread Starter rcotgrov

    (@rcotgrov)

    This is indeed correct. I’ve had to purchase a .org.uk domain as a workaround for now which did the trick nicely. I don’t know how to report the problem to Google per say. If anyone does, let me know and I’ll document it and hope they will do something. It may not necessarily just be Google Chrome as well. You may find Firefox or some other browsers do the same. IE though as you say it works fine, there is no issues. I have not tested anything other than Chrome & IE.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Cookies Domain Mapping Login/Logout problem’ is closed to new replies.