12

I'm providing a file download (usually CSV or PDF) in my JSF web application on a HTTPS (SSL) host. It works fine in most browsers, only IE7/8 gives the following error:

Internet Explorer cannot download foo.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 think the error is related to the JSF <h:commandLink> tag not being compatible with IE.

<h:commandLink value="Download" action="#{bean.download}" />

How is this caused and how can I solve it?

2 Answers 2

15

This is a typical MSIE error message when a download is been provided over HTTPS (SSL) while the response headers are been set to disable the browser cache via no-cache. This issue is not related to JSF.

You need to relax the response headers which have influence on the browser cache. It should not contain the no-cache instruction. You could set it to public, private or no-store.

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

See also MS KB Q316431.

Additionally, if you happen to run on WebSphere Application Server, then add the below header as well in order to prevent it from overriding the Cache-Control header afterwards:

response.setHeader("CookiesConfigureNoCache", "false");             

See also IE cannot download files over SSL served by WebSphere.

2
  • My concern is, the file really isn't public and actually should never be cached.
    – Ken Kinder
    Feb 24, 2012 at 21:35
  • 1
    Use either one of Cache-Control: no-store or Cache-Control: private and Pragma: private instead, which seems to be the closest thing that still works over SSL in Internet Explorer.
    – bassim
    Jun 24, 2013 at 13:18
1

The issue wouldn't be related to jsf as it's just converting commandbutton to html which is accessible in all browsers. I'm guessing the issue is in abcBean.downloadCSV. Are you setting the content-type properly on the csv file?

Can you describe what occurs in your action method?

1
  • The content type can hardly be the issue since it works fine in other browsers and MSIE ignores it anyway (it instead determines it based on the request URL, yes how astonishing...).
    – BalusC
    Feb 17, 2011 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.