5

I have a multi-wordpress installation (3.x) with 5 sites and only one of them is using SSL.

All of these are running on their own domain, and the http://ssldomain.com forwards to https://ssldomain.com.

Still, this seems to break wordpress upgrades.

Now I get a message:

Upgrade Network

https://nonsecureddomain.com

Warning! Problem updating https://nonsecureddomain.com. Your server may not be able to connect to sites running on it. Error message: SSL: no alternative certificate subject name matches target host name 'nonsecureddomain.com'

It seems that at some point WP decides to go HTTPS for this domain, where it is not supposed to.

The network itself is the one running on HTTPS(SSL), and what concerns me is that

https://mydecureddomain.com/wp-admin/network/site-info.php?id=5

Is listing the site with a hardcoded HTTPS prefix which seems to to be configurable?

enter image description here

  • 3
    There are multiple open bugs for multisite plus SSL. Either use SSL for all sites … or forget it. – fuxia Aug 3 '14 at 11:27
  • 3
    thanks @toscho - it would be wonderful if you could also put some links to these bugs, this would count as a valid answer. – sorin Aug 4 '14 at 11:20
2

This is an old question, but I figured I'd post my answer as I just had to deal with this problem and figured out a temporary workaround that got it to work for me.

WARNING: This requires modifying core which is NOT recommended. If you use this workaround, you should probably remove the workaround when you've finished updating.

As of WP 4.1, the problem exists in /wp-admin/network/upgrade.php line 67. Here, $upgrade_url is being passed to wp_remote_get(). But $upgrade_url is getting its SSL cues from your current page. So if your current page is HTTPS, then it will adopt HTTPS for all of the sites that are being upgraded, even if those sites aren't supposed to be HTTPS.

Now, from the code, it seems like you should be able to filter admin_url() in order to change $upgrade_url from HTTPS to HTTP. However, when I tried this filter, it didn't work. So what I ended up having to do was insert the following code right before wp_remote_get() on line 67:

if( strpos( $url, $your_ssl_domain ) === false )
    $upgrade_url = str_replace( 'https', 'http', $upgrade_url );

Hope that helps someone.

  • Can you please provide a link to a bug or change request, as this seems to be a fix to a known bug and making a local fix does not make sense, we need to fix the core. – sorin Feb 21 '15 at 19:03
  • I doubt this is the best way to fix it. It just worked in my particular case and I figured I'd share what I did. – Sam Feb 23 '15 at 16:21
  • see wordpress.stackexchange.com/a/179916/944 -- almost fixed. – sorin Mar 2 '15 at 11:59
  • Thanks for this. Definitely saved my skin on our ~10k multisite install! Unfortunately, waiting months and months for a patch to be approved isn't really an option when you've got a halfway-upgraded multisite network. While not pretty, I don't see any negative consequences to this. Heck, I was considering just writing a one-off script to cURL the upgrade script for every site in our network... Thanks again. – rinogo Apr 12 '16 at 23:35
1

This is currently a known bug and already has a patch submitted for review. Feel free to add your feedback directly to the raised bug:

https://core.trac.wordpress.org/ticket/31405

1

Thanks to @Sorin for posting the trac. From there I found a solution using just filters in functions.php (so no editing the core)

Thanks @mensmaximus for posting there:

Link: https://core.trac.wordpress.org/ticket/33887#comment:3

<?php
add_filter( 'network_admin_url', 'mmx_network_admin_url', 1, 2 );
function mmx_network_admin_url( $url, $path ){
    $url = "https://my_master_domain/wp-admin/network/" . $path;
    return $url;
}

add_filter( 'admin_url', 'mmx_admin_url', 1, 3 );
function mmx_admin_url( $url, $path, $blog_id ) {
    $blog_id = ( $blog_id ) ? $blog_id : get_current_blog_id();
    if ( preg_match( '|^http(s)?://|', $url) ) {
        $blog_details = get_blog_details( $blog_id );
        $url = $blog_details->siteurl . '/wp-admin/' . $path;
    }
    return $url;
}
  • Great work, thanks for sharing. I can confirm that this still works for upgrading DB from WP 5.03. to 5.1 – rob_st Feb 22 at 9:55
-5

We can add https in very simple way.... No need to had code all these in any hook....

  1. Log in to wordpress admin
  2. Go to Settings > General
  3. Find WordPress Address (URL) and Replace HTTP with HTTPS
  4. Find Site Address (URL) and Replace HTTP with HTTPS
  5. Click Save Changes

Edit .htaccess file and add bellow code

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^huepixel\.com$ [NC]
RewriteRule ^ https://www.your domain.com%{REQUEST_URI} [L,R=301]

Install wordpress-https Plugin and configure it....

That's All

For multisite you can configure accordingly.

  • 2
    Please don't post links as answers. Links die, which in turn kills an answer. Dead answers is useless and are buried. So please file an edit and add all relevant info from the link inside your answer through an edit – Pieter Goosen Dec 19 '14 at 16:24
  • 1
    Please address the issues mentioned in the question. Be specific. – fuxia Dec 19 '14 at 16:34
  • This answers seems to have nothing to do with multisite wordpress and secured and unsecured domains. Seems to be only related to securing wordpress single site. – sorin Dec 31 '14 at 16:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.