最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ssl - Occasional HTTPS Mixed Content Warning

programmeradmin1浏览0评论

we are stumped fixing this problem. It eventually just fixed itself.

We installed SSL, changed settings -> general URL to point to https version of the site. All assets seem to load just fine. However, we noticed today that one specific page has the mixed content warning and didn't load assets. All other pages were fine. Then, 10 or so minutes later, this page resolved itself and it loaded via https. All was fine! We didn't change a single thing.

What could cause an occasional "outage" of loading content over ssl?

We are using total cache plugin, but are not using a cdn. I did not try turning off or clearing cache.

We have not edited wp_config.php to force ssl or anything...may try that next.

We cannot find any hardcoded http links in the codebase. The theme seems to have set all asset loads and we aren't including any customs ones (not that I can find).

Still digging on this but if anyone out there has any insight it would be greatly appreciated!!

we are stumped fixing this problem. It eventually just fixed itself.

We installed SSL, changed settings -> general URL to point to https version of the site. All assets seem to load just fine. However, we noticed today that one specific page has the mixed content warning and didn't load assets. All other pages were fine. Then, 10 or so minutes later, this page resolved itself and it loaded via https. All was fine! We didn't change a single thing.

What could cause an occasional "outage" of loading content over ssl?

We are using total cache plugin, but are not using a cdn. I did not try turning off or clearing cache.

We have not edited wp_config.php to force ssl or anything...may try that next.

We cannot find any hardcoded http links in the codebase. The theme seems to have set all asset loads and we aren't including any customs ones (not that I can find).

Still digging on this but if anyone out there has any insight it would be greatly appreciated!!

Share Improve this question asked Feb 14, 2017 at 22:39 DannyDanny 5614 silver badges4 bronze badges 4
  • Is there a mixed bag in post_content? W3TC would definitely contribute to this as I've seen this before on one of our sites. I would recommend you do a complete purge of object, and page caches. – Brian Fegter Commented Feb 14, 2017 at 23:37
  • 1 thanks for the input @BrianFegter - we ended up being able to replicate and fix by turning off our caching plugin, Total Cache. Likely something to do with serving caches...really sucks as it broke the site randomly! Beware when using caching is all I learned from this. – Danny Commented Feb 15, 2017 at 18:29
  • Unless you can reproduce the problem and get the snapshot of what the HTML was, I think this is going to be next to impossible to debug. You need a specific example of what was non-HTTPS in order to figure out how to fix it, otherwise it could literally be anything, even a 3rd party script on a server you don't control – Tom J Nowell Commented Nov 8, 2019 at 14:29
  • I was pulling my hair out with this issue and then the walk through at the link below was very helpful in making sure that a WordPress site will load fully in HTTPS. wpfixit/wordpress-mixed-content – Jarrett Gucci Commented Mar 1, 2021 at 15:20
Add a comment  | 

1 Answer 1

Reset to default 0

I just saw this problem myself on my site. The issue for me was that the site was available as both https://example/ and http://example. If the first request to a page was for the http version, the links to assets would be to http:

  • http://example/wp-content/themes/customizr/assets/front/img/thumb-standard-empty.png
  • http://example/wp-content/uploads/...
  • etc.

These http asset links would get put into the cache. When somebody requested the page over https and the cached page was returned, they would get mixed content due to the http links in the page cache.

If the first person to visit a page was over https, everything works as expected. The page cache would get built with https asset links.

I solved this problem by redirecting to https by putting the following code in the top my my .htaccess file and then purging all caches.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

That way WordPress never gets hit with http requests and the cache always gets built appropriately.

I had thought that setting the site URL to include https would be enough to prevent this problem. However, that does not appear to be the case. My "Settings" -> "WordPress Address (URL)" and "Settings" -> "Site Address (URL)" have always both been set to https://example. I had thought that WordPress itself issued redirects to HTTPS with that setting, but apparently it doesn't. I had also thought that this setting would be used for writing the links to asset URLs, but apparently that is not true either.

发布评论

评论列表(0)

  1. 暂无评论