Domain Mapping Bug - Force https setting in admin not saving 2

The "Would you like to force https in login and admin pages:" is stuck in the "No" position. It was in the "Yes" position for many months until I had to make an unrelated change on another option within domain mapping settings. Now it defaults to "No" and has broken the ability for a sub-site user to log into any subsite!

This has happened to other people in the past apparently... https://premium.wpmudev.org/forums/topic/domain-mapping-bug-force-https-setting-in-admin-not-saving?utm_expid=3606929-52.ZpfeUjXqSWOCaoohIqoFQQ.0&utm_referrer=https%3A%2F%2Fwww.google.com

I tried several combinations of Domain Mapping settings and can't get setting to stick. The log-in screen of any sub-site on my multisite has broken SSL on Chrome. Subsite users cannot log in to their sites either. Looking at the html source, it posts to non-ssl version of the site - very bad! Non-sub-site login seems fine though.

I opened my website to support access. Thank you!

  • Anang

    Hi Carmelo

    Thanks for contacting us :slight_smile:

    Would you mind to turn off cache and security related plugins ? I suspect it's because plugins conflict , causing you can't change that option.

    You can also force redirect SSL on your admin dashboard by changing your htaccess file,if the issues persist after you do plugin conflict test. You can jump in to this thread to see it how :
    https://premium.wpmudev.org/forums/topic/force-httphttps-conflict-with-ithemes-security-hide-backend#post-901305

    Let me know if you have further questions :slight_smile:

    Best Regards

  • Carmelo

    I just disabled all plugins except Domain mapping and that setting still doesn't stick. I'm thinking it's not a plugin conflict, so I'm re-enabling everything. Other settings under domain mapping do stick, but not "Would you like to force https in login and admin pages:" which seems to be breaking the multisite logins and SSL.

    As for forcing SSL, I already do on the backend through Wordpress wp-config.php and through scripting in Varnish. Everything was working fine just as expected until I made an unrelated change to another domain mapping setting.

    Over the next hour, I'll try downgrading the plugin to see if anything changes.

  • Carmelo

    Alright, after downloading and installing 8 old versions, I was able to get the setting to stick by reverting all the way back to version 4.2 !!! I skipped a few versions, so I'm not exactly precise about which version made the setting stick, It's between 4.2 and 4.2.0.6. I then changed and saved the setting then swapped the old plugin for the newest version plugin I had before. Multisite subsite logins work now and SSL is green and padlocked! Woo hoo!

    However, there is still this issue of me not wanting to save changes with the newest version of the Domain Mapping plugin as it may cause the same problems again. And I'll have to use 4.2 to change that setting again.

    Is it possible for your team to look into why this is and/or apply a fix in a new version? Let me know how I can help.

    Thanks!

  • Patricia BT

    Hi there

    Just to say it often happens with Domain Mapping. I have had numerous issues with this plugin, and specifically this one : saving options doesn't stick, depending of the versions

    I do exactly as you do, I keep an old version 4.2.0.6 beside the new one, I rename folders in order to use the old version, then I save my options, then I re-rename to use the new version.

    I didn't contact the forum here everytime, as the reply is always to check if there is a conflict with another plugin. but well, it happens on different sites, sometimes with very few plugins installed (and tried with all disabled), and no cache.

    This comment is just to let the support staff that it is indeed a problem.

    Best

  • Tyler Postle

    Hey Patricia and Carmelo,

    Our developer isn't able to replicate this issue either. When the issue happens again would you be able to send me your FTP? Then I can pass it onto him so he can investigate it further :slight_smile:

    You can send that privately through our contact form: https://premium.wpmudev.org/contact/

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me.

    Send in:

    Subject: "Attn: Tyler Postle"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    **If you activate support access then no need to send in wp-admin

    Cheers,
    Tyler

  • Patricia BT

    Hi Tyler and Carmelo

    I cannot send any auth for my main service install where customers are and which is in prod.
    However I'm setting up a new website with domain mapping, and (several) domain names attached to it, and we can (temporarily) use it as a test.

    Ok, so Domain Mapping is working correctly for now with this:
    - default WP (4.3) with Multisite as subdomains. (akismet and hello plugin removed)
    - WPMUDEv Dashboard (3.5.3)
    - domain mapping plugin (4.4.0.9), with sunrise.php at the correct place as well as "on" in wp-config.

    So now I will add the plugins I'm usually using, esp those from my other site(s) where it doesn't work. Maybe we will then discover with what Domain Mapping is conflicting.

    @Carmelo : could you post the list of plugins your are using please?

    @Tyler Postle : it's very common for me to have issues with Domain Mapping. Usually I use it with Multi-Domain and often with WPML... there is almost always something :slight_smile: usually I solve by using an older version of Domain Mapping (however the version number I mentioned in my previous comment is wrong, sorry)

    Talk soon :slight_smile:
    Patricia

  • Patricia BT

    Domain mapping is still working, after WP install, multisite, domain mapping, multi domain, 3 sub-sites, 2 with multiple domains added
    as well as WPML, and even SiteGround's own cache plugin (I'm on a Siteground VPS).
    (see my process so far : http://yl.is/20150909/ )

    so this is rather good news

    so tomorrow (evening, CEST), I'll add more plugins as on the other sites, 1 by 1 and report here... there must be one :slight_smile:

    @Carmelo : what other plugins do you use beside Domain Mapping?

  • Carmelo

    Sorry for the late reply Tyler. I do not have FTP installed as it is a dedicated server that has Wordpress and the components to make wordpress work (plus some caching) only on it and nothing else. Lately I've had developers on my site, but I just activated the support access.

    @Patricia BT : As far as the plugins I have active: 41 plugins so far, about 10 of which are WPMUDEV. I'd like to keep my list of plugins private, however is there a way to send via private message on these boards?

  • Patricia BT

    Yeah I totally understand about keeping the plugin list private.
    you can send me an email to patricia [at] virtuaza [ dot] com

    I'm not part of WPMUDev team, so thank you for your trust.
    I just happen to have the Domain Mapping settings not saving issue same as you, on *some* of my installs, including a client's, so I'm more than happy to try to finally find what is the problem, by investigating further instead of just doing the workaround I told earlier (I even had to change the settings directly in the DB once :slight_smile: ). Also at the very moment I'm installing this site so it's the best time for me to test :slight_smile:

    Have a great day, I'm out today and will be back in the night (European time).

    Cheers

    I'm asking the list to see if one is the same as mines. In order to test those first. I'm really surprised, why it works on some sites and not on others (which are all on the same VPS), so the light from someone else list can help.

  • Patricia BT

    @Tyler Postle
    I have granted access to one of the non-functioning sites = where the settings are not saving in the netword admin.
    site is torre.me
    (you'll see lot of unused plugins, there were copied from another site)
    I tried deactivate all the network activated plugins, to see if anything related.
    and on site id 2 = my own blog, I tried deactivate WPML, and some others, and domain mapping didn't work better. you can see that patriciabt.com should map to patricia.torre.me

    Strange enough, when I deactivated domain mapping, the mapping worked!!!! (main url, not the menu links ie), when I reactivated, the mapped domain goes to the origianl domain as if I filled the settings to redirect to original, but none of the setting sticks.

    Some years ago, in a many-version-back bug I had, it was that the entries could not save in the database because one table or whaatever, was missing.

    You can play and try and even crash the site, I made a 1-click staging copy (files and DB9, a great tool at Siteground.

    Hope we find out!! thankfully domain mapping is working where I have my customers on Pro Site at virtuaza.com/net , but this is another site, pffffew :slight_smile:

    I also make tests on other sites, and it works on my newly created one... strange.

    Talk soon
    Patricia

    PS : btw I hope it's fine I totally hijacked Carmelo's post, as we have the exact same symptoms, if solved for one, solved for all :slight_smile:

  • Tyler Postle

    Hey Patricia, thanks a lot for all your effort is reproducing the issue and letting us check it out :slight_smile:

    So just to be sure, are you okay with us troubleshooting on this site? torre.me. This would include deactivating plugins/themes, turning debug on, potentially unampping/remapping domains etc.

    *Anything we do, we'll revert afterwards so the site will remain how we found it once we're done :slight_smile: and nothing should stay changed for very long.

    Look forward to hearing back!

    Cheers,
    Tyler

    PS. I received the FTP credentials too, thanks.

  • Patricia BT

    Hi Tyler

    First, thank you very much for the Rep points! really appreciated... (I should help more to get 1000 before February :wink: )

    so yes, I do confirm that you can mess with the site, crash, delete, change, deactivate, change settings and play like it's Christmas :slight_smile:

    just tell me when done and I'll revert to previous state ia the staging copy and backup.

    Anyway I doubt people read a lot my perso blog as I do not write consistently. I will post something however when you are done and DM works.

    Cheers!

  • Patricia BT

    Thanks, so if you think it's server related, here are some more info :

    - Domain Mapping works on some of my sites, and not on others.
    - all my installations are on the same server, a VPS at Siteground, so all the php, apache, mysql etc versions are identical, (PHP 5.3.29; I can set different php versions but this one is the default one, used on one site that doesn't work and one that does)
    - WP has been installed, and DB created, usually with Softaculous.
    - all are multisite, with domain mapping, some with multidomains, some with WPML (which has also a sunrise, but it's not related, as where it works there is also WPML, and where it doesn't it' with or without WPML
    - they are in different cPanel accounts (but same settings)
    - same chmod
    - I use the same IP everywhere
    - the domains are all having my server's nameservers at their registrars, on some domains (of some of my clients so this is on the site that works), it's only the A name.
    - all the domains are added in cPanel as "parked" domains.
    - I added a wildcard *. as subdomain in cPanel to all the "main domains" (the ones that old the main WP address)
    - domain mapping plugin has been installed sometimes via the WPMUDev dashboard, sometimes via ftp but I can't remember which ones...

    if I think to some more details, I'll add below.

    now 2 questions :
    - where are supposed to be the Domain Mapping entries in the DB ?
    - Can I test the dev version you are talking about in one of the comments above?

  • Patricia BT

    OK; I solved it

    I now revoke the remote access.

    As I told you, I thought it was a database issue, because in the past years, it has always been a databse issue when I had a problem with DM.

    I searched in the table : prefix_sitemeta
    and listed all the entries with domain_mapping metakey, or beginning with dm_

    in the site were there was the problems, it looks like all my changes kept adding to the database (not 1 entry replacing the other, or not replacing the row entry), and in the database of the site where it works, there was only 2 lines...

    I'm not sure it's related, because yes I have more domain on the 1st one, but anyway, rows seem to be adding and adding

    the other day I tried to deactivate reactivate the plugin
    now I deactivated, deleted all the DB entries and reactivated, and now I could make the settings "stick", such as my IP address, the https if I had needed that option, and other stuff like "direct to mapped domain" in the sub-site DM interface.

    I'm not sure what caused it, and hope this gives hints to Sam, but I couldn't give you more time to investigate as I need to publish something on my site.

    @Carmelo : are you feeling comfortable editing your database? (make backup) ?

    Thx and see you at the next version :wink:
    Patricia

  • Tyler Postle

    Hey Patricia,

    Awesome troubleshooting :slight_smile: thanks for posting this. I'll pass this onto Sam, although he will definitely see it once he gets to this ticket.

    As for trying out the dev version, that will be Sam's call - whether he's comfortable enough with the current beta version to let members try it out, I'll ask him. Thanks again for all the help you've provided here. Sending some more points your way.

    Cheers,
    Tyler

  • Carmelo

    Thanks Patricia for the info.

    Ok, so I went into the database (prefix_sitemeta) searched and found a few entries with meta_key's that had dm_ in the front and their meta_value's: dm_301_redirect=1, dm_cname=[no value], dm_hash=[long hex looking value], dm_ipaddress=[servers main IP], dm_no_primary_domain=0, dm_redirect_admin=1, dm_remote_login=1, dm_user_settings=1. So I believe these are supposed to be there or was it a remnant of the "other" public domain mapping plugin I tested ages ago? It doesn't seem like there is any overabundance of extra dm_ entries.

    Are all these settings related to WPMUdev's Domain Mapping plugin? Also, where is the value in my database that the specific setting "Would you like to force https in login and admin pages" set? I pushed the Domain Mapping save button and lost this setting as expected, but didn't notice those values listed above change after checking again.

  • Patricia BT

    well I deactivated the plugin, then deleted all entries with dm_ and with domain_mapping meta keys, then reactivated the plugin and it created "clean" entries in the DB.
    and yes those you list are related, see for example the cname is empty, or dm_redirect_admin=1, dm_remote_login=1 are telling if the domain should go to the mapped domain or original one... all the settings that didn't work before. You say they didn't change, and that's precisely the issue... settings don't "stick" as they seem not to save in the data

    anyway make backup, and if you are worried, make extra backup of that precise table (export), and if anything goes wrong, just delete the table and replace with the copy (sql with the previous export)

  • Sam

    Hello @Patricia BT

    Thanks for your valuable input and the awesome troubleshooting you've done so far.
    By the following:

    in the site were there was the problems, it looks like all my changes kept adding to the database (not 1 entry replacing the other, or not replacing the row entry), and in the database of the site where it works, there was only 2 lines...

    i understand DM adds multiple records with "domain_mapping" as meta_key to sitemeta table, right ?
    Have you been able to replicate this issue again after cleaning up previous records?
    And i'd like to know if you've installed any other domain mapping plugins other than ours (before or after installing WPMUDEV DM)?

    Thanks,
    Sam

  • Patricia BT

    Hi @Sam,

    I'm not sure about the other plugin, because it's a site that I installed quite a long time ago. However I'm sure I have it since several version of the plugin, including when there was other problems (maybe we can find some of my old posts here).

    I attach 2 pics, 1 with the problem (it's the staging databse I created just before to grant access, so it has the issue), and 1 with clean DB.

    Next I can try to install the other domain mapping plugin (the one from the WP repo), and have a look at the DB.
    Talk soon

  • Patricia BT

    Hi there

    For info, I tried to install another (*the other*) domain mapping, the one in the wordpress repository, "wordpress-mu-domain-mapping" (by Donncha O Caoimh/Ron Rennick) , to see if this would "break" the use of WPMUDev's, but no... it still works well, so this was not the reason.

    I have tried other domain mapping related stuff in the past, like "wp-multi-network" (by JJ Jacoby/D Dean) but this is currently working on another site, with your DM too. Same with WPML advanced use of different domain names for different languages, it works with your DM, provided I add some WPML code in sunrise.

    so basically, now I cannot recreate what added redundant lines in the DB and was stopping us to save settings...

    @Sam , tell me if there is anything else I can try.

    Cheers
    Patricia

  • Carmelo

    So, my old method of reverting to the old version of Domain Mapping (4.2) to change one setting stopped working when I started using the newest version (4.4.1.0). I ended up looking at the code and making a change to 1 character in the code...

    I've since started writing my own plugins and editing numerous other plugins to work with my system. So, my work around for this now is to edit the domain-mapping plugin directly @ domain-mapping/classes/Domainmap/Module/Mapping.php . As of version 4.4.1.0, line 1222 of the function "set_login_form_action", I just edit the scheme from "http" to "https". For example:

    ...
    function set_login_form_action($url, $path, $scheme, $blog_id ){
         if( !$this->is_login() || is_main_site() ) return $url;
    
         $admin_mapping = $this->_plugin->get_option( 'map_admindomain' );
         $scheme = self::$_force_admin_ssl ? "https" : "http";
         if( $path === "wp-login.php" ){
    ...

    The line with the $scheme variable and "http", change that to "https" so there is no choice but https. I have to do this currently because if I don't, no one can log into subsites and the login form action is http, which brings up an error in Firefox about unsecured submit actions (my multisite backend is SSL secured, but not the frontend).

    Hope this helps someone, but I'd love to know why this login schema still doesn't save or read correctly to/from the database.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.