Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have IIS 7.5 set to compress all static files (the default), yet it does not compress .js (javascript) files. When I turn on failed request tracing for compression, the error I get for the compression is:

NO_MATCHING_CONTENT_TYPE

I read about this, and the only solution I saw posted was to make sure application/x-javascript (and not just application/javascript) is specified as a mimetype seen as 'static' content. So I adjusted my applicationHost.config to have this:

    <httpCompression>
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" dynamicCompressionLevel="5" />
        <scheme name="deflate" dll="%windir%\system32\inetsrv\gzip.dll" />
        <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </staticTypes>
    </httpCompression>

However, I still see the same error in failed request tracelogs: NO_MATCHING_CONTENT_TYPE. Any other ideas?

share|improve this question
add comment

1 Answer

Make sure that you have .js files mapped to one of these MIME types (e.g. application/javascript'), and not something else entirely, e.g.text/javascript`. (If you just issue a HTTP request using something like curl or wget against one of these files as a client, what MIME type is the server returning it as?)

share|improve this answer
    
I believe it is mapped properly, the response headers show application/x-javascript: HTTP/1.1 200 OK Cache-Control: max-age=345600 Content-Type: application/x-javascript Last-Modified: Wed, 21 Sep 2011 16:16:41 GMT Accept-Ranges: bytes Etag: "da4944d97978cc1:0" Server: Microsoft-IIS/7.0 Date: Thu, 29 Dec 2011 20:18:30 GMT Content-Length: 13598 –  Mason G. Zhwiti Dec 29 '11 at 20:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.