I’m developing a Confluence Static Content Macro and I’m running into an issue where Confluence is displaying a cached version of my macro despite my best efforts to tell it not to.
I’m using ACE and have tried setting the etag header to be randomly generated, setting the cache-control header to be
no-cache or both at once (
no-store,no-cache) but whatever I try, sometimes Confluence will return a cached version of my macro rather than the version my server has returned.
What I’ve generally been doing is loading a page, which displays my macro, editing the page to change the width and then publishing. This then shows me a cached version of my macro despite actually making a request to the server hosting my macro to get an updated version. If I then refresh the page, Confluence correctly displays the latest returned contents of the macro from my server.
I’ve tried changing the renderingMethod of my macro from GET to POST but it seems to be that despite setting all the cache headers I can find to tell Confluence not to use a cached version of my macro it still is.
When Confluence does display the cached version, it does so very quickly so I can tell it is not getting it from my server.
The same behaviour seems to apply even if I make different types of edits to the page.
The URL for my macro includes the page.id and page.version so the URL/body of the requests coming to my server are different every time but it just seems that after publishing, Confluence displays a cached version of my macro, despite seemingly making a new request to my server for a new version but then just ignoring the new response until the page is refreshed.
All this is happening in Chrome with DevTools open and “Disable Cache” enabled so it can’t be the browser doing the change (also the page Confluence renders after publishing has the latest changes from the edit).
As my macro depends on the contents of the page, having a cached version of it rendered means it will be incorrect.
Is this a bug in Confluence or is there a header or some setting I can add to stop Confluence displaying a cached version of my macro?