Foros de discusión
[RESOLVED] Cannot download documents with IE8
Thomas Berg, modificado hace 11 años.
[RESOLVED] Cannot download documents with IE8
Regular Member Mensajes: 131 Fecha de incorporación: 7/09/09 Mensajes recientes
Environment: Linux, Tomcat 7.0.27, Liferay 6.1.1 CE GA2
Sigh, there's always something with IE.
Our users have reported that they cannot download files with IE8. Since our site uses https throughout, the issue seems to be related to this old forum post. IE8 says that ".. the file cannot be written to cache..." or something similar.
As always, there's no problem with Chrome, Firefox, Safari etc. Even Internet Explorer 9 works
Something has changed from Liferay 6.1.0 CE GA, the headers served are:
Liferay 6.1.0 CE GA1:
Cache-Control:public
Connection:Keep-Alive
Content-Disposition:attachment; filename="filename.doc"
Content-Length:55808
Content-Type:application/msword
Date:Thu, 23 Aug 2012 12:40:00 GMT
Keep-Alive:timeout=15, max=70
Last-Modified:Tue, 21 Feb 2012 14:35:56 GMT
Pragma:public
Liferay 6.1.1 CE GA2:
Cache-Control:private
Connection:Keep-Alive
Content-Disposition:attachment; filename="filename.doc"
Content-Length:137216
Content-Type:application/msword
Date:Thu, 23 Aug 2012 11:41:15 GMT
Keep-Alive:timeout=15, max=100
Last-Modified:Thu, 23 Aug 2012 11:32:55 GMT
Pragma:no-cache
Is this related to Liferay or Tomcat? How do I change the Cache-Control and Pragma headers?
Already tried adding valves to tomcat/conf/context.xml as described here but made no difference.
Please advice
Regards Thomas
Sigh, there's always something with IE.
Our users have reported that they cannot download files with IE8. Since our site uses https throughout, the issue seems to be related to this old forum post. IE8 says that ".. the file cannot be written to cache..." or something similar.
As always, there's no problem with Chrome, Firefox, Safari etc. Even Internet Explorer 9 works
Something has changed from Liferay 6.1.0 CE GA, the headers served are:
Liferay 6.1.0 CE GA1:
Cache-Control:public
Connection:Keep-Alive
Content-Disposition:attachment; filename="filename.doc"
Content-Length:55808
Content-Type:application/msword
Date:Thu, 23 Aug 2012 12:40:00 GMT
Keep-Alive:timeout=15, max=70
Last-Modified:Tue, 21 Feb 2012 14:35:56 GMT
Pragma:public
Liferay 6.1.1 CE GA2:
Cache-Control:private
Connection:Keep-Alive
Content-Disposition:attachment; filename="filename.doc"
Content-Length:137216
Content-Type:application/msword
Date:Thu, 23 Aug 2012 11:41:15 GMT
Keep-Alive:timeout=15, max=100
Last-Modified:Thu, 23 Aug 2012 11:32:55 GMT
Pragma:no-cache
Is this related to Liferay or Tomcat? How do I change the Cache-Control and Pragma headers?
Already tried adding valves to tomcat/conf/context.xml as described here but made no difference.
Please advice
Regards Thomas
Thomas Berg, modificado hace 11 años.
RE: Cannot download documents with IE8
Regular Member Mensajes: 131 Fecha de incorporación: 7/09/09 Mensajes recientes
Update: I found out where this change was made. Now I just need to find out why and if there's something I can do for users of IE8. Preferably without using an ext-plugin. Is ServletResponseUtil wrappable with a hook-plugin?
ServletResponseUtil.setHeaders(
HttpServletRequest request, HttpServletResponse response,
String fileName, String contentType) {
// 6.1.0
response.setHeader(
HttpHeaders.CACHE_CONTROL, HttpHeaders.CACHE_CONTROL_PUBLIC_VALUE);
response.setHeader(HttpHeaders.PRAGMA, HttpHeaders.PRAGMA_PUBLIC_VALUE);
// 6.1.1
response.setHeader(
HttpHeaders.CACHE_CONTROL, HttpHeaders.CACHE_CONTROL_PRIVATE_VALUE);
response.setHeader(
HttpHeaders.PRAGMA, HttpHeaders.PRAGMA_NO_CACHE_VALUE);
Mika Koivisto, modificado hace 11 años.
RE: Cannot download documents with IE8 (Respuesta)
Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
Fixed in LPS-29645. There's no way to wrap the util because it's a static class. All you can do is patch the source and replace the class.
Mika Koivisto, modificado hace 11 años.
RE: Cannot download documents with IE8 (Respuesta)
Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
On second thought if you front your Liferay with Apache you can use mod_headers and unset the Pragma header for all urls starting with /documents like this:
<locationmatch "^ (image |documents )">
Header unset Pragma
</locationmatch>
Thomas Berg, modificado hace 11 años.
RE: Cannot download documents with IE8
Regular Member Mensajes: 131 Fecha de incorporación: 7/09/09 Mensajes recientes
Hello Mika,
We're using Apache in front, just tested using mod_headers and it solves the problem!
Kiitos (thanks) a bunch
Regards Thomas
We're using Apache in front, just tested using mod_headers and it solves the problem!
Kiitos (thanks) a bunch
Regards Thomas
Mika Koivisto, modificado hace 11 años.
RE: [RESOLVED] Cannot download documents with IE8
Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
No problem. I'm glad it helped.
tom mahy, modificado hace 11 años.
RE: [RESOLVED] Cannot download documents with IE8
Junior Member Mensajes: 38 Fecha de incorporación: 2/05/12 Mensajes recientes
Thank you. Saved me a lot of time.