Pergunta

I'm experiencing a problem when using Sitecore MVC 3 rendering with GZip content compression.

I followed the blog post of John West, how to enable MVC in Sitecore.

Until now it works perfectly, the pages are rendered. But if I run the page on IIS and enable content compression (gzip), the page doesn't load. I get a "Content Encoding Error" in Firefox. Other browser display various error messages.

Has somebody experienced similar issues? Do you have any idea what the problem may be? Where should I start checking? I have to use compression on the pages.

We are using Sitecore 6, Update 5: "Sitecore 6.6.0 rev. 130404" Could this be a Sitecore bug?

EDIT 1: I am also running ASP.NET WebForms on the Sitecore instance and it works fine also with gzip compression.

EDIT 2: I have 'dynamicCompressionBeforeCache' enabled. My web.config related to gzip config:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
  <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
  <dynamicTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </dynamicTypes>
  <staticTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
Foi útil?

Solução

Sitecore confirmed that they can reproduce the issue. When setting dynamicCompressionBeforeCache="true", the encoding does not work correctly for some reason.

One solution is to remove this setting. After applying dynamicCompressionBeforeCache="false" it works fine.

Outras dicas

You should probably enable gzip in your web.config

<system.webServer>
  <httpCompression directory="%SystemDrive%\inetpub\
temp\IIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
    <dynamicTypes>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>
    </dynamicTypes>
    <staticTypes>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>
    </staticTypes>
  </httpCompression>
  <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
</system.webServer>

There are a few more tricks here Setting the gzip compression in asp.net

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top