.map MIME type
Source maptext & code
application/jsonSource maps that map minified code back to its original source in browser devtools.
| MIME type | application/json |
|---|---|
| Extensions | .map |
| Content-Type | application/json |
| Compress in transit? | Yes — enable gzip or Brotli |
Good to know
- Browsers fetch
.mapfiles only when devtools are open, using the//# sourceMappingURL=comment or theSourceMapresponse header. - Publishing source maps exposes your original source; restrict them or upload them only to your error tracker if that matters.
Serve .map files with the right type
The response header to send:
Content-Type: application/json
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
nginx (inside the types block in mime.types)
application/json map;
Apache (.htaccess or server config)
AddType application/json .map
Express
res.set("Content-Type", "application/json");Python
import mimetypes
mimetypes.add_type("application/json", ".map")HTML file input
<input type="file" accept=".map,application/json">
Check it
See what a server sends for a file, and what type a local file really is by its contents:
curl -sI https://example.com/file.map | grep -i '^content-type:' file --mime-type file.map
Frequently asked questions
What is the MIME type for .map files?
application/json.
What Content-Type header should a .map file be served with?
Content-Type: application/json. It compresses well, so let the server apply gzip or Brotli.
Related types
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options