Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE cannot download files over SSL served by WebSphere

IE 7 & 8 both throw an error when users attempt to download a csv file over https.

Internet Explorer cannot download downloadPage.jsf. Internet Explorer was not able to open this internet site. The requested site is either unavailable or cannot be found. Please try again

I read about the issues IE has in relation to caching so I changed the response to allow public caching. See this issue: IE cannot download foo.jsf. IE was not able to open this internet site. The requested site is either unavailable or cannot be found

response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "public");

But I am still getting this error.

Any ideas what else could be causing the issue? Here's the complete snippet:

HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
response.setContentType("text/plain");
response.setHeader("Content-Disposition", "attachment; filename=\"" + browserFilename + "\"");
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "public");
response.getOutputStream().write(contentBytes);
context.responseComplete();
like image 500
Thomas Buckley Avatar asked Jul 04 '11 15:07

Thomas Buckley


1 Answers

It appears that WebSphere automatically adds Cache-Control:no-cache=set-cookie response header when cookies are included in the response. IE8 & older do not like this when downloading over SSL.

There are two possible fixes as per this IBM Developerworks forum thread:

  1. Add the custom response header CookiesConfigureNoCache:false for HTTP transport Channel in WebSphere (it's true by default).

    response.setHeader("CookiesConfigureNoCache", "false");             
    
  2. Explicitly set the Cache-Control header after cookies are being added, this will override the WebSphere-set one.

    response.addCookie(...);
    response.addCookie(...);
    ...
    response.setHeader("Cache-Control", ...);
    
like image 187
Thomas Buckley Avatar answered Oct 19 '22 23:10

Thomas Buckley