Multisite SSL Implementation

I’m trying to implement SSL on a multisite installation, but can’t make the admin resources load using https.

I was getting a lot of Mixed Content errors on the backend of my site. But now my WP Dashboard returns – Too Many Redirects errors.

I’ve tried to use the default .htaccass and disable plugins via FTP but doesn’t help.

However, the front-end of my site works fine and I’m also able to login to my subsites.

  • Kasia Swiderska
    • Support nomad

    Hello duplix,

    This is really weird issue – I can see that some resources are not loading with https, even tho I manually changed http to https in database in all necessary places, but looks like change in database did not affected site at all.

    Can you tell me more how did you switch to SSL in first place?

    I don’t see any cache in your cPanel – are you aware if your hosting provider has any cache (like varnish) enabled on server?

    Another thing – you are using CloudFlare – is it possible to disable it and see if there will be any change?

    kind regards,

    Kasia

  • duplix
    • WPMU DEV Initiate

    Cloudflare is on develop mode since I was asked on the chat.

    I made 2 things:

    1. Changed all the http://infoprodutofacil.com.br to https://infoprodutofacil.com.br on the DB.

    2. Installed WordPress HTTPS

    I was allowed to log in on network, but the resources loaded using http.

    Then I ask on CHAT. The person who worked on it made some changes, I don’t know exactly each one of them. She changed .htaccess, but I can’t say which were the changes.

    Since then I can’t reach http://infoprodutofacil.com.br/wp-admin/. It redirects to https, and return too many redirects.

    To solve that, I tried to change some contents on DB back to http://, but didntt worked.

  • duplix
    • WPMU DEV Initiate

    I decided to start again the step by step that You gave. But it’s something weird…

    I did only the first step to force admin SSL and included that line on wp-config:

    define(‘FORCE_SSL_ADMIN’, true);

    Well, it didn’t changed nothing on the admin area. Still http.

    Please, help me on that…

  • duplix
    • WPMU DEV Initiate

    Based on the behavior I have described here (the IMPORTANT 1,2 and 3) I found a solution:

    /** SSL */

    define(‘FORCE_SSL_ADMIN’, true);

    // in some setups HTTP_X_FORWARDED_PROTO might contain

    // a comma-separated list e.g. http,https

    // so check for https existence

    if (strpos($_SERVER, ‘https’:wink: !== false)

    $_SERVER=’on’;

    “This solution is great if you’re using a flexible SSL behind a proxy DNS like Cloudflare.” Stephan P on stackexchange.com.

    So, maybe You need to take that in consideration to adjust Domain Mapping plugin to work on those scenarios.

  • Rupok
    • Support Ninja

    Hi duplix,

    Thanks for sharing the workaround that worked for you. I am sure this will help others having similar setup.

    According to WordPress Codex:

    If WordPress is hosted behind a reverse proxy that provides SSL, but is hosted itself without SSL, these options will initially send any requests into an infinite redirect loop. To avoid this, you may configure WordPress to recognize the HTTP_X_FORWARDED_PROTO header (assuming you have properly configured the reverse proxy to set that header).

    Example:

    define('FORCE_SSL_ADMIN', true);
    // in some setups HTTP_X_FORWARDED_PROTO might contain
    // a comma-separated list e.g. http,https
    // so check for https existence
    if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
    $_SERVER['HTTPS']='on';

    You can also indicate the following line in the .htaccess file (before anything else) :

    SetEnvIf X-Forwarded-Proto https HTTPS

    You will get full details about this from here: https://codex.wordpress.org/Administration_Over_SSL

    I believe these will help.

    Please feel free to contact us if you have any other query. We are always here to help.

    Have a nice day. Cheers!

    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.