Force link references to https [SOLVED]

I am running phpList on Amazon AWS behind a load balancer that handles SSL/HTTPS requests.

The phpList server receives everything as HTTP requests on port 80.

Stylesheets and images, etc are referenced as http:// links, which prevents them from loading (at least in Chrome).

Is there a way to force the links to https:// even though the server detects the connection as http?

I hope I am making sense.


I am not sure if this is the best way to handle this, but adding a content security policy header to my Apache configuration seems to have done the trick.

In my case, this is in a <VirtualHost> configuration, but it could also be in an .htaccess file.

    Header set Content-Security-Policy "upgrade-insecure-requests; default-src https:"

This server header tells Chrome and other compliant browsers to fetch all http referenced content via https, which allows the stylesheets and other files to load over https.

Maybe this will help someone else.

Well I tried that in my Virtualhost and it threw an Invalid Command. Running Apache on Ubuntu