The Problem:
My goal is to enable gzip compression of responses from IIS for the content-type "application/json*", but when the wildcard * is added instead of an exact string match compression fails.
Enabling the FailedRequestLogs and making a request to IIS for which the response is:
HTTP/1.1 200 OK Cache-Control: private Content-Length: 41 Content-Type: application/json; charset=utf-8
The Result is:
DYNAMIC_COMPRESSION_NOT_SUCCESS, Reason: NO_MATCHING_CONTENT_TYPE
My configuration & Results:
When "C:\Windows\System32\inetsrv\config\applicationHost.config" is configured with:
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" noCompressionForHttp10="false" noCompressionForProxies="false"><scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /><dynamicTypes><add mimeType="application/json*" enabled="true" /><add mimeType="*/*" enabled="false" /></dynamicTypes><staticTypes> <add mimeType="application/json*" enabled="true" /><add mimeType="*/*" enabled="false" /></staticTypes></httpCompression>
The "application/json*" wildcard matching fails.
But when configured with:
<add mimeType="application/*" enabled="true" />
The wildcard is evaluated and works correctly.
Additionally, when configured with:
<add mimeType="application/json" enabled="true" /> <add mimeType="application/json; charset=utf-8" enabled="true" />
The exact string matching also works.
In further testing, I found that the wildcard only seems to work immediately following the '/' in the mimeType. (ex: "abc/*")
The Question is, why doesn't wildcard matching work when there are characters after the '/' like in "application/json*"?