Confluence doesn't caching extra javascript resources

Víctor Ayllón November 29, 2018

Hi, I'm trying to include an extra javascript resource using the "Insert Custom HTML" field in the confluence configuration.

I've included this line in the field:

<script type="text/javascript" src="/includes/js/jquery.sticky.js"></script>

Captura de pantalla 2018-11-30 a las 1.20.48.png

 

It works well in Chrome / Safari / IExplorer browsers, but when I try to access to Confluence with Firefox I'm getting a very slow response loading the pages.

Looking the Network load when loading the pages I can see that the included resource is loading very slow. Confluence is not caching the .js file and every load takes more than 20 seconds !

Captura de pantalla 2018-11-30 a las 1.22.15.png

Is there any other way to include this resource?

 

2 answers

0 votes
Tobias Anstett (K15t)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 30, 2018

Hi @Víctor Ayllón,

If you know how to develop a simple confluence app the web resource plugin module could help you >> https://developer.atlassian.com/server/framework/atlassian-sdk/web-resource-plugin-module/

If you define a web resource with context alt.general (loaded everywhere except administration screen) and define a resource of type download for your js file there it will be merged in Confluence' batch js/css files.

Best, Tobias

0 votes
Maksym Fedoryshyh
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 29, 2018

Can you please click on the request and inspect http response headers? I suspect that this resource comes with headers, which disable caching, that's why firefox tries to download it on every page load.

Confluence provides appropriate http caching headers for all resources it is aware about (f.e. registered plugin resources). The problem with custom resources is that Confluence doesn't know if it is appropriate to cache them (f.e. for security or legal reasons).

If jquery.sticky.js resource is served by Confluence (with "Insert Custom HTML" you can add any resources, f.e. hosted somewhere on cdn and not controlled by Confluence), you can add proper http caching rule by overriding urlrevrite.xml in your Confluence (here you can find an example for caching rule)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events