Opened 6 years ago

Last modified 5 years ago

#9781 confirmed New Feature

Need Setting to append suffix to assets for cachebusting builds

Reported by: Blaine Garrett Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc: joel.peltonen@…


I would like to have a config option to append a suffix to the filename of js and css files.

Use case: The build/deploy tools I use append the git commit hash to the end of the file names of static cdn assets when bulding. This busts the browser/proxy/etc cache when deploying new revisions of our application. For the time being, I had to make edits to the compiled source to make this work.

For thorough coverage, I'd suggest: config.js_suffix = config.css_suffix = config.img_suffix = doesn't apply to me, but might for others

Example filenames given the latest build commit hash is a3fdee /static/js/plugins/ckeditor/ckeditor_a3fdee.js /static/js/plusins/ckeditor/config_a3fdee.js /static/js/plusins/ckeditor/plugins/autogrow/plugin_a3fdee.js /static/js/plusins/ckeditor/themes/moomo/editor_a3fdee.js

All of my js/css assets are app

Change History (10)

comment:1 Changed 6 years ago by Jakub Ś

Keywords: suffix assets getUrl baseUrl path plugins git removed

comment:2 Changed 6 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

There is timestamp property that prevents caching:!/api/CKEDITOR-property-timestamp

All you have to do is e.g. insert it below script import instruction:

<script type="text/javascript" src="../ckeditor.js"></script>
	CKEDITOR.timestamp = 123456;		

With every build you can change this value and it will work as expected.

comment:3 Changed 6 years ago by Blaine Garrett

The CKEDITOR.timestamp property is just a query string arg appended to the url of assets, right? For the way our builds work, we would need to append it to the asset filename rather than the query string. TinyMCE has something similar, but ckeditor is otherwise far better for our use. Wouldn't this be a simple addition to getURL()?

comment:4 Changed 6 years ago by Piotrek Koszuliński

I've never seen similar feature request, so adding new config option to satisfy so rare need, especially that there is already an option to deal with cache, doesn't seem to be reasonable.

However, if we'll see that more users need this option we can consider adding it.

comment:5 Changed 6 years ago by Blaine Garrett

When posing this to our core dev team, they said to cite this article:

Basically, we run into proxies that do no invalidate on query string alone.

comment:6 Changed 6 years ago by Piotrek Koszuliński

Resolution: invalid
Status: closedreopened

Ok, this article proves that this may not be so rare case, so I'm reopening this issues.

But it also says this:

Proxy administrators can change the configuration to support caching resources with a querystring, when the caching headers indicate that is appropriate.

I also think that solution based on rewrite rule is possible.

So fortunately alternative ways of solving this issue exists.

comment:7 Changed 6 years ago by Piotrek Koszuliński

Status: reopenedconfirmed

comment:8 Changed 6 years ago by Blaine Garrett

Excellent. Thanks!

comment:9 Changed 6 years ago by Jakub Ś

I see that Yahoo also recommends it -

Here is interesting debate although topic is different (it is worth to read all comments) -

Especially this part is interesting:

because Safari and Opera tended to ignore cache directives on linked resources when reloading pages (or hitting Enter in the location bar) as opposed to accessing them by clicking links

Post is rather old (2008) but if this feature is going to be implemented it is worth checking if this is still true.

comment:10 Changed 5 years ago by Joel

Cc: joel.peltonen@… added

CC out of curiosity

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy