Wrong mime types for CSS/JS resources

Wrong mime types for CSS/JS resources

by Greg Robson -
Number of replies: 5

Hi,

I've installed Moodle (first time in several years) and it has mostly gone according to plan. On loading the home page I don't get the CSS and JS resources.

I'm getting errors of "Resource interpreted as Stylesheet but transferred with MIME type text/html:" and the JS files are not being loaded either. Is there something specific I need to do to fix the mime types?

I'm running:

  • Moodle 3.4 (Latest Stable)
  • PHP 7.1.13
  • Nginx 1.13.3
  • PostgreSQL 10.1

I've tried a few solutions after Googling the error message, but nothing has worked so far?


Attachment Error.png
Average of ratings: -
In reply to Greg Robson

Re: Wrong mime types for CSS/JS resources

by Greg Robson -

For anyone else facing this issue, be sure to set up your Nginx rules prior to installation.

https://docs.moodle.org/34/en/Nginx

It is mentioned in the documentation. Just as feedback the documentation says that some "links and pointers are at Installing AMPIISNginx." ... and that they are helpful - they do not say that it's an explicit requirement for a working installation.

This might be why I was also having issues using the web installer.

Average of ratings: Useful (2)
In reply to Greg Robson

Re: Wrong mime types for CSS/JS resources

by Raketen Wissenschaft -

Is my issue related to that? https://moodle.org/mod/forum/discuss.php?d=363937


Thanks,

Florian

In reply to Raketen Wissenschaft

Re: Wrong mime types for CSS/JS resources

by Greg Robson -

Most likely! Moodle calls urls that have a file path after a script path. e.g.

http://moodle.domain/lib/javascript.php/1515751172/lib/javascript-static.js

...after http://moodle.domain/lib/javascript.php there is a path: /1515751172/lib/javascript-static.js - Nginx is getting confused as it doesn't realise there's an argument to a script.


Average of ratings: Useful (1)
In reply to Greg Robson

Re: Wrong mime types for CSS/JS resources

by Matteo Scaramuccia -

Hi Greg,
that is called PATH_INFO, which Moodle calls slasharguments and supporting slasharguments is recommended by Moodle by default unless you configure Moodle to disable its usage (Site Administration > Site administration > Server > HTTP).
That's the reason why for location ~ [^/]\.php(/|$) { and fastcgi_split_path_info  ^(.+\.php)(/.+)$; .

Please, remember that it will be required some day (MDL-49114) and it is actually required by some Activities like SCORM.

HTH,
Matteo

Average of ratings: Useful (1)