• Hi everyone,

    So, I’m building a wordpress site, and everything was going well, until I tried to look at a page where I had inserted an image into the body. The image wasn’t displaying. When I examined the code, I saw this:

    <img src="//consultancymedia.com/cmiwp/wp-content/uploads/2018/09/joann18.png" alt="" width="480" height="727" class="alignleft size-full wp-image-54" srcset="https://consultancymedia.com/cmiwp/wp-content/uploads/2018/09/joann18.png 480w, https://consultancymedia.com/cmiwp/wp-content/uploads/2018/09/joann18-198x300.png 198w" sizes="(max-width: 480px) 85vw, 480px" />

    Essentially, wordpress was trying to display http images, even though I was viewing the page through https, resulting in no image being displayed.

    I did a quick search here as to how to resolve the issue, and found that the problem was that in my general settings, the site was defined as using http. To change it all I needed to do was go in and change this to https.

    That’s when the whole site broke. I started seeing the “too many redirects” error on the front page and the administration pages.

    I put the setting back to http through the database, which returned the site to how it was before.

    Now, we use Cloudflare on the site. Cloudflare has a setting that essentially re-writes any instance of http to https, and that setting was on for the site. When I turn that setting off, I could clearly see that although I was loading https, most of the site assets were loading over http. I could also see that only the front page was forwarding to https, as when I visited the other pages, the url would remain http. I don’t know where that https forwarding was coming from.

    I disabled all modules, and changed the theme, but no effect.

    I searched the site for instances of wp_redirect() but found none.

    I checked the httaccess file for anything that might be causing the problem, and found nothing.

    Then I found this post:

    https://wordpress.stackexchange.com/questions/302965/too-many-redirects-only-when-trying-to-access-wp-admin-page

    Following the instructions, I added:

    `if (strpos($_SERVER[‘HTTP_X_FORWARDED_PROTO’], ‘https’) !== false)
    $_SERVER[‘HTTPS’]=’on’;’
    to the server, then changed the admin setting back to https, and the site worked, and the image loaded, but suddenly I had a new problem. Although the administration menu loaded, when I went to any admin page, I was getting a permission denied screen. I checked the adobe logs, but no user errors, so this was wordpress denying me access to my backend.

    To test I removed these two lines of code and I could get back into the admin settings.

    So, I feel pretty lost at this point. What I need is to have the images in posts load, and it took me down this rabbit hole of broken-ness, and I’m not sure what I can even try to do next. I’ve put things back where they were for now, so everything works except for images posted to the body of the pages (images loaded from the template and style sheets aren’t getting re-written so they look fine).

    Does anyone have any idea about how I can get my site to be consistently SSL compliant without breaking everything?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Dion

    (@diondesigns)

    CloudFlare is making this a much more difficult problem because it is does its own crazy things with URLs, and it has several settings, not just one, that can affect your URLs.

    I suggest you disable CloudFlare, then get https:// working correctly on your site, and then re-enable CloudFlare. If your site has problems after re-enabling CloudFlare, then you know the problem is a CloudFlare setting.

    With Cloudflare you should check if you don’t have any page rules enabled, which may conflict with the WordPress redirect.

    Als check your CF SSL option:
    If you have your own certificate, you should select Full SSL. If you use the CloudFlare SSL option, choose flexible SSL. Not selecting the correct option might cause redirect loops.

    When you start doing this, I would recommend to enable development mode first.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘https too many redirects problem’ is closed to new replies.