CSS not loading because: Refused to apply style because its MIME type

1. Caddy version (caddy version):

latest

2. How I run Caddy:

a. System environment:

ubuntu LTS

b. Command:

paste command here

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

I use this rewrite to make website offline for maintanace for other users.

@public_networks not remote_ip xxxxxxxxxxxx
                rewrite @public_networks index.html
                root * /home/useron/public_html/maintenance.site
                file_server

3. The problem I’m having:

Refused to apply style because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

**

Problem is with rewriting mentioned above - checked. Any solution?

**

4. Error messages and/or full log output:

Refused to apply style because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

5. What I already tried:

@css {
              file
              path *.css
}
header @css Content-Type text/css

No error with this code in console but problem still persists - css is not loaded.

6. Links to relevant resources:

Rewriting mentioned above is the cause (checked). Any solution?

I moved css styles from file to tag inside html page. Now styles are ok, but background image .jpg Content-Type is “text/html”, so not loaded.

.right-section{background-image: url(work.jpg)}

This topic was automatically closed after 30 days. New replies are no longer allowed.