Wordpress mixed content warnings
Tue, Sep 17, 2019 · 1 minute readwebwordpress
If
you have installed Wordpress behind a proxy
AND you are seeing mixed content warnings in your site
Then
this is for you.
We typically install Wordpress in containers running behind Caddy and HAProxy.
That works well but there is a gotcha.
The Wordpress is_ssl
function (in wp-includes/load.php
) uses very simple checks to see if
a page is being served over https or not. One of the checks is that the port using for the site is 443.
Our containers would typically use a port number above 1024 because we run Caddy in those containers
as a non root user and we don’t want to run setcap to allow access to low port numbers.
If we run Wordpress in these containers then the result is mixed content warnings and possibly 301 or 302 redirect loops if we were to change siteurl and home URLs to https.
Moral -
For Wordpress in a container behind a proxy Caddy (or any lesser web server) needs to run on port 443 to avoid mixed content warnings and possible redirect loops.