| Extension | MIME / Content-Type | Description |
|---|---|---|
.html, .htm |
text/html; charset=utf-8 |
HTML document |
.css |
text/css; charset=utf-8 |
Cascading Style Sheets |
.js, .mjs |
application/javascript |
JavaScript / ES module |
.json |
application/json |
JSON data |
.xml |
application/xml |
XML document |
.txt |
text/plain; charset=utf-8 |
Plain text |
.csv |
text/csv; charset=utf-8 |
Comma-separated values |
.svg |
image/svg+xml |
Scalable Vector Graphics |
.png |
image/png |
PNG image |
.jpg, .jpeg |
image/jpeg |
JPEG image |
.webp |
image/webp |
WebP image |
.avif |
image/avif |
AVIF image |
.ico |
image/x-icon |
Favicon |
.woff |
font/woff |
WOFF web font |
.woff2 |
font/woff2 |
WOFF2 web font |
.ttf |
font/ttf |
TrueType font |
.pdf |
application/pdf |
PDF document |
.zip |
application/zip |
ZIP archive |
.gz |
application/gzip |
Gzip archive |
.mp4 |
video/mp4 |
MP4 video |
.webm |
video/webm |
WebM video |
.mp3 |
audio/mpeg |
MP3 audio |
.wasm |
application/wasm |
WebAssembly binary |
Content-Type Configuration GuideA MIME type (Multipurpose Internet Mail Extensions, standardized by IANA) tells browsers and HTTP clients how to interpret a file's bytes via the Content-Type response header. Sending the wrong MIME type - for example serving .mjs as text/plain or .svg without +xml - causes browsers to block ES modules, refuse stylesheets under X-Content-Type-Options: nosniff, or render SVGs as plain text.
.js, .mjs): Must be served as application/javascript or text/javascript. Older Nginx mime.types files sometimes omitted .mjs, breaking ES module imports..webp, .avif, .svg): Use image/webp, image/avif, and image/svg+xml..woff2, .woff): Serve as font/woff2 and font/woff (alongside CORS headers when loaded across subdomains)..wasm): Requires application/wasm so browsers can stream-compile WASM modules with WebAssembly.instantiateStreaming().In Nginx, include the standard include /etc/nginx/mime.types; inside your http {} block and add any missing extensions inside a types {} block, such as application/javascript mjs; or image/avif avif;. In Apache, use AddType image/webp .webp or AddType application/javascript .mjs in .htaccess.
X-Content-Type-Options: nosniff matter? It prevents browsers from MIME-sniffing files and executing disguised scripts, which makes sending the exact right Content-Type header mandatory for scripts and stylesheets.; charset=utf-8? Always include charset=utf-8 on text-based responses like text/html, text/css, and text/plain. Binary formats like PNG, WOFF2, and PDF do not use a charset parameter.After updating your web server or CDN rules, run curl -sI https://example.com/app.mjs | grep -i content-type to confirm the exact Content-Type header returned in production. Pay special attention to object storage buckets (AWS S3, Cloudflare R2, GCS), because uploading files without setting metadata can default to application/octet-stream and force browsers to download assets instead of rendering them.