6 Replies Latest reply on Mar 31, 2010 5:59 PM by stefan_tausendpfund

    ui.pack.js and framework.pack.js not cached in IE with SSL enabled

    stefan_tausendpfund

      Hello,

       

      the js files and css files are not cached in jboss when using https. The server adds a

      Pragma: No-cache
      

      in Header which prevents the IE to cache the content with https enabled. Firefox ignores this field and sends a check modified request.

       

      This can be fixed in the InternetResourceBase.java:

       

      --- src/main/java/org/ajax4jsf/resource/InternetResourceBase.java       (revision 16680)
      +++ src/main/java/org/ajax4jsf/resource/InternetResourceBase.java       (working copy)
      @@ -411,6 +411,7 @@
                   }
                   context.setDateHeader("Expires", System.currentTimeMillis() + expired);
                   context.setHeader("Cache-control", "max-age=" + (expired / 1000L));
      +            context.setHeader("Pragma", "Public");
               } else {
                   if (contentLength > 0) {
                       context.setContentLength(contentLength);
      

       

      Is this the right place to add and is there a chance to get this in the actual 3.3.3 release?

       

       

      regards

        Stefan

        • 1. Re: ui.pack.js and framework.pack.js not cached in IE with SSL enabled
          nbelaevski

          Hi,

           

          Please take a look: https://jira.jboss.org/jira/browse/RF-7452

           

          At what RF/IE/JBoss versions does this reproduce?

           

          Message was edited by: Nick Belaevski

          • 2. Re: ui.pack.js and framework.pack.js not cached in IE with SSL enabled
            stefan_tausendpfund

            Hello Nick,

             

            thank you for your hint. For long time I also read this thread in another context (File downloading in https and IE). We also tried the mentioned configuration in JBoss. But this causes that the pragma no-cache is removed totally and therefor a reverse proxy in front of the Jboss server caches also the dynamic pages. We use the JBoss 4.2.3 with portal 2.7.2, JSF 1.2 (no seam), richfaces 3.3.3-SNAPSHOT and portletbridge 2.0.0-SNAPSHOT configured with https and a reverse proxy from microsoft to get it out in the internet.

            Internet Explorer 7/8 do not cache the resources, firefox and opera do it right.

             

            As richfaces sets the expire date and the cache control I think its the right place also to set this pragma flag. In the w3 spec are a lot of "should" words when talking about this flag, but the MS products seem to take this flag seriously than the Cache-control header.

            Do you see any side effects when using this additional flag? Do you have any other hint to get the caching done in IE browsers?

             

            regards

              Stefan

            • 3. Re: ui.pack.js and framework.pack.js not cached in IE with SSL enabled
              nbelaevski

              Stefan,

               

              Can you please post your web.xml?

              • 4. Re: ui.pack.js and framework.pack.js not cached in IE with SSL enabled
                stefan_tausendpfund

                Hi Nick,

                 

                Attached is the web.xml from my project. My sample test project uses the same configuration except the security configuration (Its on my other machine where I do not have access now). But this does not change anything in the behaviour.

                Changing the LoadScriptStrategy from NONE to ALL causes that the scripts are streamed by the the serveResource of the bridge. With NONE the scripts are defined as header injection in the jboss-portlet.xml (my configuration).

                • 5. Re: ui.pack.js and framework.pack.js not cached in IE with SSL enabled
                  nbelaevski

                  Stefan,

                   

                  We've had problems with "Pragma" header in the past, so it was decided not to put the proposed fix into 3.3.3.Final.

                  I suggest to remove wildcard mapping for resources collection and add it only for your pages that really need to be covered by this. What do you think?

                  • 6. Re: ui.pack.js and framework.pack.js not cached in IE with SSL enabled
                    stefan_tausendpfund

                    Hello Nick,

                     

                    thanks a lot!

                    I just tested it on my machine, but its only a partial success. Resources which are linked to the web application are cached if security is disabled for /faces/rfRes. But resources streamed through the portlet serveResource are not cached if you are in a secured portal page. So for example the spacer gif is not cached by the IE:

                     

                    GET 200 image/gif https://myserver:8443/portal/authsec/portal/default/RichFacesEchoPortlet/RichFacesEchoPortletWindow?action=b&cacheability=PAGE&rfRes=images%2Fspacer.gif
                    

                     

                    The amount of requests can sum up to a huge load and the performance gets down.

                    Also if you use the ALL parameter for the LoadStrategy the js are not cached again and you will have a bad performance on each request.

                    Can you provide me some additional information about your problems concerning the pragma flag? It's also related to IE?

                     

                    regards

                      Stefan