Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages

Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages

by Rob Hardy -
Number of replies: 7

Hi,

We're finding that for some https pages, up-to-date versions of Firefox and Chrome are not loading the stylesheets (IE9 is not affected). The Chrome console shows a number of messages such as:

[blocked] The page at https://moodle.yorksj.ac.uk/my/ ran insecure content from http://moodle.yorksj.ac.uk/theme/yui_combo.php?3.2.0/build/cssreset/reset-min.css&3.2.0/build/cssfonts/fonts-min.css&3.2.0/build/cssgrids/grids-min.css&3.2.0/build/cssbase/base-min.css.

This is not happening in 2.3.1 on our test server, but it will be a few months until we can upgrade. Is there a reasonably easy fix for this?


Thanks,

Rob.

Average of ratings: -
In reply to Rob Hardy

Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages

by Simon Story -

Hi Rob,

Looks like your theme is linking to 'http' locations. You'll need to fix the theme so it doesn't do this. Can you get the theme to use a relative url (Ie, not specify the http://hostname) at the beginning?

Basically Chrome and Firefox are trying to protect the user from insecure information leakage by not loading content transmitted over an insecure connnection.

It's a feature, not a bug smile

In reply to Simon Story

Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages

by Rob Hardy -

Thanks for the reply, Simon. I believe you're right about the cause, and I've confirmed that it doesn't happen in an older version of Firefox. The problem is that the stylesheets are not linked in directly in the theme code - they're being loaded using JavaScript, and I've yet to find exactly where this is happening.


It appears to be the same issue discussed here on a Yui forum. The suggested solution is to get code being loaded from Yahoo's CDN to load from the local server instead, but I'm not sure how straightforward this is going to be in Moodle.

In reply to Rob Hardy

Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages

by Levente Imre Nagy -

changeing in config.php

// added to force https://
$CFG->sslproxy=true;
// the default protocol is https
$CFG->wwwroot   = 'https://sitename/';

Average of ratings: Useful (3)
In reply to Levente Imre Nagy

Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages

by Rob Hardy -

Thanks for the replies, and sorry about the delay in getting back to you, but we did finally get to the bottom of what was causing it. It was nothing to do with Moodle.

A beta version of Google's mod_spdy had been installed and enabled for some time. This attempts to use the SPDY protocol for secure connections, if supported by the browser, and defaults back to HTTPS if it isn't supported - the problem was only occurring in browsers that support SPDY.

I'm not sure whether the problem had always been occurring, and not been noticed, or if an Apache upgrade had changed the way something worked, and triggered it. However, disabling the module resolved the issue. I think we'll be doing a lot of testing of any upgraded version before we consider re-enabling it.

Average of ratings: Useful (1)
In reply to Rob Hardy

Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages

by Jesús Basco Lopez -

I solve this problem adding these lines at the end of /theme/<current_theme>/config.php


if ((isset($_SERVER['HTTPS'])) and ('on' == $_SERVER['HTTPS'])) {
    $CFG->httpswwwroot = 'https://'.$_SERVER['HTTP_HOST'];
} else {
    $CFG->httpwwwroot = 'http://'.$_SERVER['HTTP_HOST'];
}

In reply to Levente Imre Nagy

Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages

by Vincent Gullotta -

Thank you Levente, this solved my problem! =D

In reply to Levente Imre Nagy

Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages

by Mariam SABIL -

Thank you so much!