1

Currently I am serving sourceMappingURL files with following contenttype:

Content-type:text/javascript; charset=utf-8

Is this correct? It works, but I don't know, if it is correct. What other headers should I send along with it?

Christian
  • 3,503
  • 1
  • 26
  • 47

1 Answers1

3

Javascript sourcemaps should be served with Conent-type: application/json since the file is single JSON object.

To supply source map over HTTP, use SourceMap: <url> header.

Or you can link source map in file comment for both, javascript (//# sourceMappingURL=<url>) and css (/*# sourceMappingURL=<url> */).

Note: X-SourceMap <url> is deprecated.

Source: Source Map Revision 3 Proposal

Kristian
  • 1,058
  • 1
  • 11
  • 16
  • This does not answer my question. When I download for instance jquery with bower sourceMappingURL is already there. I will not change that. I wrote my own middleware in node to serve them. Which content-type or mimetype should I give them? – Christian Oct 17 '13 at 10:20
  • Sorry, improved my answer. – Kristian Oct 18 '13 at 06:33