Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Unwanted Cache Headers added on Image/Icon retrieval

    Hi,

    We are using v9.0p_2013-10-17/Pro Deployment (built 2013-10-17) and are experiencing unexpected (and in our case undesired) behavior of cache headers which seem to be added automatically on the http request when retrieving certain images.

    More specifically, the following headers seem to be added onto the request:
    - Cache-Control:max-age=0
    - If-Modified-Since:Mon, 21 Oct 2013 10:43:34 GMT

    The leads to the browser performing additional request on the 2nd time the image is loaded to verify if the image needs to be refreshed.
    We are however trying to reduce the number of HTTP calls made during page loads, this seems to be invalidating our cache policy controlled by the web server (max-age set to a date far in the future for example). For your reference, we are using fingerprinting of the URL and can therefore use a long expiration period since we are sure that resources will be pulled in when a new version is deployed.

    Could you indicate how we can disable the injection of these headers on the client side? I assume this is controlled by SGWT code (we use among others IconButton.setIcon).

    Thanks in advance for you guidance.

    #2
    This isnt normal. Take a look at the server-side JavaDoc for the FileDownload Servlet to see how caching can be configured. Either the FileDownload Servlet is involved and has begin a non-default configuration that's just incorrect, or, some system unrelated to SmartGWT is responsible for these headers.

    Comment


      #3
      Thanks, it turned out to be the FileDownload servlet indeed. We had it configured in the web.xml.

      The problem is now slightly different, we are getting the following cache headers slapped onto the http requests of the initial html page and all resources loaded directly from that page (including the sgwt js files):
      - Cache-Control:no-cache
      - Pragma:no-cache

      The FileDownload is now completely disabled, I traced the request on the exact point where it enters the web server (in dev mode: org.mortbay.jetty.Server.handle) and the headers are already there.
      I'm a bit puzzled to where these could be coming from.

      Any tips would be greatly appreciated.
      Last edited by jan.swaelens; 22 Oct 2013, 01:09. Reason: Further investigation lead to other conclusion.

      Comment


        #4
        I did some further testing using the showcase website (http://www.smartclient.com/smartgwt/showcase). It seems that it is yielding the exact same behavior. The first page download (and following js downloads) are also provided with those 2 headers in the request (Cache-Control:no-cache and Pragma:no-cache). Looking at the http response I also assume that you would be wanting a more fine grained cache control of the page: ETag and Last-Modified are used).

        This leads me to believe that it's something more generic causing this, HTML, GWT or even browser related? Even regular sites seem to produce this behavior.

        cheers
        Last edited by jan.swaelens; 22 Oct 2013, 06:49.

        Comment


          #5
          That's definitely not true of our public Showcase.

          This suggests you are going through some kind of proxy, or perhaps have some plugins installed in whatever browser you are using.

          Comment


            #6
            Hi,

            You are right - I tested this on several machines and OS-es and there seems to be different behavior here and there. Thanks for the feedback though.

            cheers

            Comment

            Working...
            X