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