3 Replies Latest reply on Jun 30, 2010 7:09 PM by Damian Harvey

    Missing Cache-Control directive when serving via https (feat

    Kai Hennig Newbie

      Hello, I have set in my web.xml:
      org.ajax4jsf.Filter -> enable-cache = true
      along with the context parameter:
      org.richfaces.LoadScriptStrategy = ALL

      As an example the resulting response header for the file framework.pack.js.xhtml contains:
      Cache-Control -> max-age=43200
      Expires -> (a date 43200 seconds ago)

      When requesting this file via HTTPS my browsers (Firefox 3.0 and Safari 3.1.2) will not cache it (bad thing since this file is almost 280 KB in size). I figured out that the Cache-Control directive "public" is missing. Files served via HTTPS will only be cached if Cache-Control includes "public" e.g.:
      Cache-Control -> public, max-age=43200

      I believe this is true to other browsers as well (just a guess, no access to IE).

      I took a look at the souces and figured out org.ajax4jsf.resource.InternetResourceBase.sendHeaders(ResourceContext) does not allow to add another Cache-Control directive. Is that right? So what about a new org.ajax4jsf.Filter parameter to do so? Or should the Cache-Control directive "public" generally be added in sendHeaders if enable-cache is set to true?

      BTW: I also tried to write a filter to override the Cache-Control header, without success. The headers for RichFaces resource files did not change at all.

      FACT: RichFaces 3.2.1
      FACT: Glassfish 9.1_02
      FACT: JSF 1.2_04-b20