MIME types
Content-Type tells the browser what it received: HTML, CSS, JavaScript, JSON, image, XML, or a downloadable file.
If the type is wrong, a page can look broken even when the HTTP status is 200.
Check Content-Type
curl -kI https://getsrv.app/
curl -kI https://getsrv.app/sitemap-index.xml
For a concrete asset:
ASSET="$(find /var/www/getsrv.app/assets -maxdepth 1 -type f | head -n 1 | sed 's#^/var/www/getsrv.app##')"
curl -kI "https://getsrv.app$ASSET"
Common types
| File | Content-Type |
|---|---|
.html | text/html |
.css | text/css |
.js | application/javascript |
.json | application/json |
.xml | text/xml or application/xml |
.svg | image/svg+xml |
.png | image/png |
.jpg, .jpeg | image/jpeg |
.webp | image/webp |
.ico | image/x-icon |
.txt | text/plain |
.pdf | application/pdf |
.zip | application/zip |
.wasm | application/wasm |
.woff2 | font/woff2 |
HTML
Expected:
curl -kI https://getsrv.app/ | grep -i content-type
content-type: text/html
If HTML is served as text/plain, the browser may show source text instead of rendering the page.
CSS
CSS should be served as:
content-type: text/css
If CSS is served as HTML, the asset path is usually broken and the server is returning fallback HTML or a 404 page.
JavaScript
JavaScript is usually served as:
content-type: application/javascript
If JS is served as text/html, the browser may refuse to execute it because of MIME mismatch.
JSON
For JSON:
content-type: application/json
If JSON is served as text/html, the client may be receiving an HTML error page instead of data.
SVG
For SVG:
content-type: image/svg+xml
SVG is an active format, so CSP and X-Content-Type-Options: nosniff matter.
Why nosniff matters
Header:
X-Content-Type-Options: nosniff
prevents browsers from guessing file types. This is good for security, but it requires correct MIME types.
If nosniff is enabled and JS/CSS are served with the wrong Content-Type, the browser may refuse to use them.
Where MIME types are configured in Nginx
Nginx usually includes:
include /etc/nginx/mime.types;
Check:
sudo grep -RIn "mime.types\\|default_type" /etc/nginx/nginx.conf /etc/nginx/conf.d /etc/nginx/sites-enabled
Typical fallback:
default_type application/octet-stream;
Post-deploy check
curl -kI https://getsrv.app/ | grep -i content-type
curl -kI https://getsrv.app/sitemap-index.xml | grep -i content-type
ASSET="$(find /var/www/getsrv.app/assets -maxdepth 1 -type f | head -n 1 | sed 's#^/var/www/getsrv.app##')"
curl -kI "https://getsrv.app$ASSET" | grep -i content-type
Common problems
CSS does not apply
Check:
curl -kI https://getsrv.app/assets/example.css
If the response is text/html, the URL does not point to CSS.
JavaScript does not run
Check the JS file Content-Type and browser Console.
Typical signal:
Refused to execute script because its MIME type is text/html
Sitemap does not parse
Check:
curl -kI https://getsrv.app/sitemap-index.xml
For sitemap files, text/xml or application/xml is acceptable.
Minimal rule
For a static site, do not check only status. Check the pair:
HTTP status + Content-Type
200 text/html for a page is good.
200 text/html for JS is bad.
404 text/html for a missing page is normal when it is a controlled 404.