Is it possible to set cache headers on items in the asset library?

samsam Member

Is it possible to set cache headers on items in the asset library?

Best Answer


  • I've just been chatting to Antti on the Kentico Cloud live chat about this. I noticed after uploading a few images to my asset library there's no way of configuring the cache-control headers (yes, for the browser cache).

    I guess normally it wouldn't make a massive difference to a site speed, but when building optimised websites for clients they will often expect to find things like these to be resolved (in particular when they're checking Google PageSpeed Insights for example).

    From my point of view, being able to go into the asset library and set individual cache control headers would be great, or maybe even a project setting to do the same across all asset library items.

  •[email protected] Member, Kentico Staff mod

    Thanks, @LiamGoldfinch. I agree that caching images might be required in some cases. However, you mentioned that client might expect this to be resolved. Who is checking page speed from the client side? (no arguing there, just trying to figure out the real-world scenario, since I always thought agency does this for client). I've added this to our long-term wishlist, however, I can't promise any dates when this might be implemented.

    Regarding cache configuration, do you configure cache-control only for images or for all assets in general (PDFs, ...). Also, how do you usually configure the cache-control? Is it individual or do you use some common configuration for most projects?

  • @TomasHruby Yeah as a web agency we will always check for website optimisations before pushing a newly built website live. However, once a site is live (and client continues to make content changes including uploading new media library assets), then site speed can often be affected by the upload of poorly optimised images etc. To a certain degree having cache control can help here (alongside re-uploading optimised versions).

    In particular, we have a few clients (mainly for Kentico CMS/EMS) who are really focused on pushing for the most optimised website in their market and want to be ahead of the rest. It sometimes just comes down to SEO purposes and not wanting to be blocked by Google for Adwords. Other times they're just checking to ensure they're not slower than their competitors.

    I personally feel like the best implementation would be a mixture of the two options I mentioned. Having the global setting across the project for all asset library items and then an override on each individual item. We'd normally try setting cache control headers on anything static which is unlikely to change, images, PDFs, stylesheets, javascript etc. The value set changes per client and their requirements though.

    I haven't checked recently, but can you create folders within the Kentico Cloud asset library? Maybe if you could, you can split assets up into different levels of caching?

  • leelee Member ✭✭

    This could be taken a step further and allow global setting of cache headers on a "per-mime-type" basis, with overrides on individual files.

    I too have many clients who regularly check site speeds themselves using tools like Pingdom, GTMetrics and Google PageSpeed Insights and often have to answer questions about why a particular check is showing red/bad (usually their content is at fault).

    For any client that is SEO/Performance focused this is a must-have before they can use Kentico Cloud.

  • mabrahams675mabrahams675 Sydney, AustraliaMember

    Last time I checked, there is no way to overwrite an existing asset in Kentico Cloud. If you wish to replace an image, you need to upload a new version and reference that.

    I think this is a good thing. So if the content for a given asset URL can't change, then it's a perfect candidate for a long expiry header. The client can always request no-cache.

Sign In or Register to comment.