Mixed Content Issues in Moodle 3.1.1

Mixed Content Issues in Moodle 3.1.1

by Joshua Wilcox -
Number of replies: 2

I have recently started receiving reports of an issue where a user logs into Moodle and their page renders as plain HTML with no CSS formatting or JavaScript functionality. We updated to Moodle version 3.1.1  and the latest version of the Essential theme at the end of August, but did not start receiving reports of this issue until several weeks after the updates were complete. I cannot seem to find a pattern as to what causes this issue: it happens intermittently, to people of various roles on the Moodle site, on different operating systems, in different browsers (Chrome, Firefox, Safari, Edge), and I cannot replicate it without waiting for someone to come in with the issue.

Here is what I have been able to deduce so far:

1. This is happening because the browser is trying to load the Moodle landing page using HTTPS rather than HTTP, but the stylesheet and script resources are still being loaded using HTTP.

2. The login page sends the user to the Moodle landing page using HTTP, but the browser receives a 301 message from the server telling it to use HTTPS to load the page.

3. Clearing the browser's cache will temporarily fix the problem.

Has anyone dealt with this issue, or have an idea as to why it may be happening?

Thanks in advance.

Joshua Wilcox

Average of ratings: -
In reply to Joshua Wilcox

Re: Mixed Content Issues in Moodle 3.1.1

by Frederic Nevers -

Hi Joshua,

Do you need your login page to use https? If not, there is an admin setting you can change to ensure only http is used. More information can be found at https://docs.moodle.org/31/en/HTTP_security

If you need https (not a bad idea in itself), then you can force it for the whole site (same URL as above).

This *should* help solve your issue, I believe.

Cheers

Fred

In reply to Frederic Nevers

Re: Mixed Content Issues in Moodle 3.1.1

by Joshua Wilcox -

Hey Fred,

Thanks for the advice. I ended up setting the entire site to use HTTPS. I haven't had any problems after that.

Joshua