Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan 1250 posts 3746 karma points admin c-trib
    Oct 14, 2013 @ 12:49
    Dan
    3

    How to leverage browser caching

    Hi,

    I've run a client site through the Google Developer Page Speed tools (https://developers.google.com/speed/pagespeed/). One of the suggestions this yields is to "Leverage browser caching". It describes this as:

    "Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network."

    I thought browsers cached resources such as CSS files and images by default, without having to set IIS to do this specifically, but perhaps IIS does need to be configured to do this and this new server just hasn't been fully set up?

    Anyhow, I can probably find out how to do this in IIS7, but my question is what implications this may have on a general Umbraco site? Are there things in the back-office that shouldn't be cached client-side or am I okay just to go ahead and set a blanket client-side cache?

    Can anyone shed any light on this? Suggestions/recommendations as to the best way to do it? What do others do in this scenario?

    Thanks folks!

  • Dan 1250 posts 3746 karma points admin c-trib
    Nov 15, 2013 @ 22:10
    Dan
    105

    Just to wrap this up for reference, the solution was to add a line to the web.config file, inside

    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="2.00:00:00" />
    </staticContent>
    

    It's documented here: http://www.iis.net/configreference/system.webserver/staticcontent/clientcache and as far as I know has no negative implications for the general running of umbraco at all.

    EDIT: The only gotcha I had with this is that it doesn't work for images generated by CropUp. In this case you just need to remove the CropUp clean URL handler from web.config: <add name="CropUpUrls" type="Eksponent.CropUp.Plugins.CleanUrls" /> (Props to Jeavon for this.)

  • Craig Cronin 303 posts 502 karma points
    Aug 15, 2015 @ 22:51
    Craig Cronin
    0

    Just had the same issue from a client. Seo company have sent the exact message and came across your post dan.

    Thanks for posting a solution to your own problem :)

  • Johan Plesner Hamann 105 posts 199 karma points
    Feb 26, 2016 @ 22:58
    Johan Plesner Hamann
    0

    Does not work for me. It write this in Google PageSpeed

    http://hestewrap.dk/CropUp/-x45/media/1019/g3069_l.png (udløbsdato er ikke specificeret)
    

    Is there anything else I can do?

    On Umbraco v6.1.6

    ~Johan

  • Md Ashraf Malik 1 post 20 karma points
    Aug 03, 2016 @ 16:58
    Md Ashraf Malik
    0

    To enable leverage browser caching in IIS you just have to follow these steps:

    1) Open your hosting panel.
    2) Open web.config file.
    3) Add cacheControlMode given bellow.
    4) Finally save you web.config file and check for caching.

    <configuration>
    <system.webServer>
    <staticContent>
    <clientCache cacheControlMode="UseExpires" httpExpires="Tue,19 Jan 2038 03:14:07 GMT"/>
    </staticContent>
    </system.webServer>
    </configuration>
    

    Source

Please Sign in or register to post replies

Write your reply to:

Draft