0

After searching and browsing a lot through different articles, I still don't have a solution for the following problem:

I get the Firefox error message:

The stylesheet https://www.xxxxxx.at/assets/css/main.css was not loaded because its MIME type, "text/plain", is not "text/css".

​I'm running nginx:stable in Docker and use the following /etc/nginx/nginx.conf:

 events {
    worker_connections 1024;
}
http {
    server_names_hash_bucket_size 64;
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    server {
        listen 80 default_server;
        listen [::]:80 default_server;

        location / {
            return 301 https://$host$request_uri;
        }
    }

    server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        server_name XXXXXXXX;

        root /site_data/XXXXXXXX;
        index index.html index.htm;

        location / { }

        ssl_certificate /ssl/XXXXXXXX.pem;
        ssl_certificate_key /ssl/XXXXXXXX.pem;
        ssl_session_timeout 1d;
        ssl_session_cache shared:MozSSL:10m;  # about 40000 sessions
        ssl_session_tickets off;

        # modern configuration
        ssl_protocols TLSv1.3;
        ssl_prefer_server_ciphers off;

    }
}

My website is basically:

<html>
    <head>
    ...
    <link rel="stylesheet" type="text/css" href="assets/css/main.css" />
    ...
    </head>
    <body>...</body>
</html>

Does anyone know a solution for this Firefox/Chrome problem?

4
  • Is your css somehow autogenerated? I had some cases where PHP generated my css and PHP had an error, and therefore the output was just an error message and not css. Thus, text/plain. Can you try to open the css file directly in your browser and confirm it's actual css in there? Commented Aug 19, 2022 at 19:17
  • It‘s valid CSS, can be opened in the browser directly. I also see that opening it directly, without using Nginx, also works just fine in the same browser. Commented Aug 19, 2022 at 19:30
  • *opening the whole site I mean Commented Aug 20, 2022 at 6:24
  • I don't get it. The issue is gone, without changing anything. Can this be a caching thing? Commented Aug 20, 2022 at 7:34

2 Answers 2

1

cache problem Ctrl+Shift+R to reload browser page might fix it.

Sign up to request clarification or add additional context in comments.

1 Comment

You are my hero of the day, stranger on the internet! 🙏
0

This is resolved, seems to be a caching issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.