Search code examples
asp.netiishttp-headerswindowwebserver

IIS Compression missing content-encoding in response even though logs show it working


I'm wanting to serve a .js file with gzip compression

I'm using IIS 7.5 and have dynamic and static content compression enabled.

In the IIS logs I can see the following log which shows that it appears to be working as it shows "Content-Encoding: gzip" in the "GENERAL_RESPONSE_HEADERS" event

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
 <System>
  <Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
  <EventID>0</EventID>
  <Version>1</Version>
  <Level>4</Level>
  <Opcode>47</Opcode>
  <Keywords>0x0</Keywords>
  <TimeCreated SystemTime="2017-03-29T23:40:41.555Z"/>
  <Correlation ActivityID="{8000000D-0003-FA00-B63F-84710C7967BB}"/>
  <Execution ProcessID="12296" ThreadID="13868"/>
  <Computer>AUD64909W0</Computer>
 </System>
 <EventData>
  <Data Name="ContextId">{8000000D-0003-FA00-B63F-84710C7967BB}</Data>
  <Data Name="Headers">Transfer-Encoding: chunked
Content-Type: application/javascript
Content-Encoding: gzip
Last-Modified: Wed, 29 Mar 2017 20:33:32 GMT
Accept-Ranges: bytes
ETag: &quot;d6af72bbcba8d21:0&quot;
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
</Data>
 </EventData>
 <RenderingInfo Culture="en-NZ">
  <Opcode>GENERAL_RESPONSE_HEADERS</Opcode>
 </RenderingInfo>
 <ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
  <EventGuid>{D42CF7EF-DE92-473E-8B6C-621EA663113A}</EventGuid>
 </ExtendedTracingInfo>
</Event>

However the response headers when viewed in Fiddler or Chrome dev tools are not showing Content-Encoding.

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/javascript
Last-Modified: Wed, 29 Mar 2017 20:33:32 GMT
Accept-Ranges: bytes
ETag: "d6af72bbcba8d21:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Thu, 30 Mar 2017 00:57:20 GMT

Any ideas why this ain't working


Solution

  • Fixed: Issue was the antivirus on my machine was stripping out the "Content-Encoding" response header.