Skip to content

GitLab Pages doesn't load assets when using absolute paths

Summary

GitLab Pages won't load assets when using absolute paths for CSS/JS files in href. Using relatives paths will work:

/path/to/file.css vs ./path/to/file.css

Steps to reproduce

In an html file, link CSS or JS files using absolute path. Run the Pages job, load the Pages site.

Example Project

Project

Pages Site

What is the current bug behavior?

CSS/JS assets do not load when linked with absolute path.

What is the expected correct behavior?

The assets should load.

Relevant logs and/or screenshots

Console error shows:

Refused to apply style from 'https://services-support-testing.gitlab.io/absolute.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

GitLab Enterprise Edition 11.1.0-rc10-ee 50497b7

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited by Namho Kim