General developer forum

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

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

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: -
Picture of Simon Story
Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages
 

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

 
Average of ratings: -
Picture of Rob Hardy
Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages
 

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.

 
Average of ratings: -
Picture of Levente Imre Nagy
Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages
 

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)
Picture of Rob Hardy
Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages
 

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)
JBL
Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages
 

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'];
}

 
Average of ratings: -
Picture of Vincent Gullotta
Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages
 

Thank you Levente, this solved my problem! =D

 
Average of ratings: -
Picture of Mariam SABIL
Re: Moodle 2.0.8 - Chrome and Firefox do not load CSS in edit profile/course pages
 

Thank you so much!

 
Average of ratings: -