SourceMap

The HTTP SourceMap response header points to a source map file, enabling browsers to reconstruct original source code from minified or bundled output for debugging.

Usage

The SourceMap header is sent by servers alongside minified, transpiled, or bundled JavaScript and CSS resources. The value contains a URL pointing to a .map file with mapping data between the transformed output and the original source.

Browser developer tools download the source map and use the mappings to display original file names, line numbers, and variable names in the debugger. Setting breakpoints, inspecting stack traces, and stepping through code all reference the original source rather than the minified version.

The source map URL is either an absolute URL or a path relative to the resource being served. Relative paths resolve against the URL of the JavaScript or CSS file, not the HTML document. The Server serving the source map controls access to the file. Restricting source map access to authenticated requests or internal networks prevents exposing original source code to the public.

This header replaces the older X-SourceMap header, which carried the same purpose under a non-standard name.

Values

URL to source map file

The value is a single URL (absolute or relative) pointing to a .map file. The file follows the Source Map format specification and contains version information, source file names, mappings, and optionally the original source content.

Example

A server returns a minified JavaScript file with a relative source map URL pointing to a .map file in the same directory.

SourceMap: /js/app.min.js.map

An absolute URL pointing to a source map hosted on a different domain. This is common when source maps are served from a dedicated asset server or CDN.

SourceMap: https://assets.example.re/maps/app.js.map

A CSS file includes a source map reference pointing to the Sass or PostCSS source mappings.

SourceMap: /css/styles.css.map

Takeaway

The SourceMap header links a minified or bundled resource to the original source code through a mapping file, giving developer tools the data needed to display readable source during debugging.

See also

Last updated: March 11, 2026