Anyone seen a "Content Encoding Error" with file downloads in Firefox?
It seems that PDFs served by Sitefinity are working fine for us via IE, but when viewed with Firefox, we get a "Content Encoding Error" and with Google Chrome, it simply fails to download.
I think it might have to do with server compression or encoding. Any ideas where to start?
Hey Dan,
Have you verified the content-type served? It should be 'application/pdf' (see 1st screenshot).
You can alter it under Administration>settings>Advanced>Libraries>MimeMappings (2nd screenshot).
<
cacheManagers
>
<
add
pollWhetherItemsAreExpiredIntervalSeconds
=
"60"
startScavengingAfterItemCount
=
"1000"
whenScavengingRemoveItemCount
=
"10"
CacheStore
=
"InMemory"
name
=
"Global"
/>
<
add
pollWhetherItemsAreExpiredIntervalSeconds
=
"60"
startScavengingAfterItemCount
=
"1000"
whenScavengingRemoveItemCount
=
"10"
CacheStore
=
"InMemory"
name
=
"ContentOutput"
/>
</
cacheManagers
>
<
mimeMappings
>
<
add
mimeType
=
"application/pdf"
fileExtension
=
".pdf"
/>
</
mimeMappings
>
<
staticContent
>
<
clientCache
cacheControlMode
=
"UseMaxAge"
cacheControlMaxAge
=
"31.00:00:00"
/>
</
staticContent
>
<
urlCompression
doDynamicCompression
=
"true"
doStaticCompression
=
"true"
dynamicCompressionBeforeCache
=
"true"
/>
That is very helpful. I'll try those changes today.
You've posted on IIS dynamic and static compression in the past. Do you find any issues with compression and PDF or Word documents?
Hey Dan,
No, so far I've not run into any issues with regards to compression and documents (pdf/doc/etc) but I've not tried it with SSL. Easy to verify in your case by just dropping a pdf into the folder and call it with a direct url (would love to hear the results)...
I wonder if this old issue for Sitefinity 3 + Server 2008 + Google Chrome Browser would be related. We are using Server 2008 and Google Chrome. If Sitefinity 5 uses a similar upload mechanism to Sitefinity 3, it would explain the MIME type issues.
Threads also possibly related:
- PDF Links broke after upgrade to Sitefinity 4.4.2117.0 (mentions PDFs work in IE, but not other browsers)
- PDF file not opening on Mobile (issues opening a PDF on Android, but not other browsers)
The following warning was logged into IIS immediately after I had another failed PDF download with Google Chrome 18 and Sitefinity 5.0.2325. I do not understand what it means, but it might be useful to someone to solve this.
It says there is an "Invalid use of a response filter". Am I causing my own trouble with incorrect server setup, or is this a Sitefinity warning?
Event code: 3005
Event message: An unhandled exception has occurred.
Event time:
4/25/2012 10:47:14 AM Event time (UTC):
4/25/2012 5:47:14 PMEvent ID:
92049b1491cb4d0a9399f77fe7da5127 Event sequence: 977
Event occurrence: 5
Event detail code: 0
Application information:
Application domain:
**** [OMITTED BY POST AUTHOR] ****
Trust level: Full
Application Virtual Path: /
Application Path:
**** [OMITTED BY POST AUTHOR] ****
Machine name: **** [OMITTED BY POST AUTHOR] ****
Process information:
Process ID: 2992
Process name: w3wp.exe
Account name:
**** [OMITTED BY POST AUTHOR] ****
Exception information:
Exception type: HttpException
Exception message: Invalid use of response filter
at System.Web.HttpResponseStreamFilterSink.VerifyState()
at System.Web.HttpResponseStreamFilterSink.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.Compression.DeflateStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Compression.GZipStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr)
at System.Web.HttpResponse.FilterOutput()
at System.Web.HttpApplication.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Request information:
Request URL: http://web3.esd112.org/docs/threat-assessment/parent-questionnaire-(spanish).pdf?sfvrsn=2
Request path: /docs/threat-assessment/parent-questionnaire-(spanish).pdf
User host address:
**** [OMITTED BY POST AUTHOR] ****
User:
**** [OMITTED BY POST AUTHOR] ****
Is authenticated: True
Authentication Type: Sitefinity
Thread account name:
**** [OMITTED BY POST AUTHOR] ****
Thread information:
Thread ID: 40
Thread account name:
**** [OMITTED BY POST AUTHOR] ****
Is impersonating: False
Stack trace: at System.Web.HttpResponseStreamFilterSink.VerifyState()
at System.Web.HttpResponseStreamFilterSink.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.Compression.DeflateStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Compression.GZipStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr)
at System.Web.HttpResponse.FilterOutput()
at System.Web.HttpApplication.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I hate to say this, but I think the internal PDF viewer in Google Chrome is part of the problem. It is just not as reliable as the Acrobat plugin used by the other browsers. At least when Firefox has an issue with PDF downloads I get a clear error message. With Google, just the white screen of death.
Jochem:
I don't have a librariesConfig.config file in my App_Data/Sitefinity/Configuration. The lines you mentioned are currently located in my Web.Config.
Is librariesConfig.config an optional config file? Could I put that code you suggested in my Web.Config?
I currently have the following in web config:
<
staticContent
>
<
mimeMap
fileExtension
=
".mp4"
mimeType
=
"video/mp4"
/>
<
clientCache
cacheControlMode
=
"UseMaxAge"
cacheControlMaxAge
=
"14.00:00:00"
/>
</
staticContent
>
<
urlCompression
doDynamicCompression
=
"true"
doStaticCompression
=
"true"
dynamicCompressionBeforeCache
=
"true"
/>
This error has taken me everywhere, but I *think* I have it fixed.
...
<
system.webServer
>
<!--<add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode" />-->
...
Hey Dan,
Hey, no problem at all. It had been working good for us until we discovered this Firefox PDF encoding issue.