I ran into this exact issue where .css
files were being served with the text/plain
content type, and the browser was refusing to apply the styles.
I went through a long list of troubleshooting steps:
Made sure the mime.types
file was included in my Nginx config
Verified that .css
was correctly mapped to text/css
Tried different location
blocks
Double-checked the file paths
Even reinstalled Nginx at some point
Still, no luck — Chrome kept showing Content-Type: text/plain
in the Network tab, and the styles just wouldn't apply.
After some frustration, I noticed that the network request in Chrome had been cached, and the cached response had the wrong content type. Here's what worked:
I disabled caching in Chrome DevTools (Network tab → "Disable cache"), refreshed the page — and suddenly the CSS was loading correctly with the right
text/css
content type.
So in my case, it was a caching issue, and all the correct configurations were being ignored because the browser was holding onto an old, incorrect response.