Error: non CSS MIME types are not allowed in strict mode

On MacOS, my site on fly.io (salas.com) is failing to apply styles. In the developer tool I see this error appearing. I cant say for sure that the error is the culprit, but that’s the path I am troubleshooting:

Did not parse stylesheet at 'https://salas.com/static/css/style.css' because non CSS MIME types are not allowed in strict mode.

Here are some key findings. See if you see what I am missing.

FastAPI setup:

app.mount("/static", StaticFiles(directory=config["output_dir"] / "static"), name="static")

HTML:

<link rel="stylesheet" href="/static/css/style.css">

Curl:

(salasblog2) ~/mydev/salasblog2 (main) curl -I https://salas.com/static/css/style.css
HTTP/2 200 
date: Tue, 08 Jul 2025 00:43:42 GMT
server: Fly/3a6a7c27e (2025-07-07)
content-type: text/css; charset=utf-8
accept-ranges: bytes
content-length: 11355
last-modified: Tue, 08 Jul 2025 00:08:00 GMT
etag: "72323f5388da84911dceca5d18eaf29f"
via: 2 fly.io, 2 fly.io
fly-request-id: 01JZKQT3VXB4DJ88E27JVBJSC3-ewr

Hi… I see this as text/html when using -i (GET request’s headers) instead of -I (HEAD request):

$ curl -i 'https://salas.com/static/css/style.css'
HTTP/2 200 
date: Tue, 08 Jul 2025 03:03:04 GMT
server: Fly/3a6a7c27e (2025-07-07)
content-length: 11355
content-type: text/html; charset=utf-8
via: 2 fly.io, 2 fly.io
fly-request-id: 01JZKZSARJG2AVE15KJQZNN8TY-ewr

/* Minimal/Compact Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[...]

(It’s a somewhat commonplace error for HEAD and GET to report different things…)

Thanks!! That was it. I would. never have thought of that :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.