Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox fails to load CSS files on HTTPS

You can see my problem here: https://www.rekuperatory.pl/ssltest/

When you open this site with Firefox it fails to load CSS. The thing is, CSS is loaded correctly in Chrome, IE and Opera. Also inline styles are read by FF correctly.

There's no issue when visiting the site via HTTP: http://www.rekuperatory.pl/ssltest/ - it loads just fine on every browser including Firefox.

The problem is only with Firefox, only via HTTPS and only with CSS in a separate file.

I've contacted hosting provider and they're saying, that everything is all right with SSL Certificate and the problem must be in linking CSS file. But I don't think that's true. Just see the code:

h1{
  color: #2387ff;
  font-size: 50px;
  text-align: center;
  background-color: #F0F8FF;
}
.hide{
  display: none;
}
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="style.css"/>
</head>
<body>

<h1>
    This should be blue and centered
</h1>

<div class="hide">CSS NOT LOADED* <br/> <small>*This DIV has "display: none" rule</small>
</div>

<h2 style="  color: #499249; text-align: center; background-color: #e6ffe3;">
    Header with inline style.
</h2>

</body>
</html>
like image 356
zorza Avatar asked Jul 10 '26 05:07

zorza


1 Answers

This is more than likely due to the incorrect headers on the response of the request for style.css

https://www.rekuperatory.pl/ssltest/style.css was not loaded because its MIME type, "text/html", is not "text/css".

Note that when you visit the http:// url the server is correctly responding with Content-Type: text/css, however on the https:// url it responds with Content-Type: text/html.

like image 65
Sphvn Avatar answered Jul 13 '26 16:07

Sphvn