[keycloak-dev] Themes: Browser cache not used for static resources (img, css, js)

jo0815 jo0815 at gmx.de
Wed Apr 24 13:39:08 EDT 2019


Hello Stian,

thanks for your quick response.
Your're right. The cache-controll-Header is set with the configured
theme/staticMaxAge (CacheControlUtil.java).

I was confused since reloading (pressing F5) triggers bypassing the
cache, which is described (for Chrome) here:
https://stackoverflow.com/questions/11245767/is-chrome-ignoring-cache-control-max-age
<https://deref-gmx.net/mail/client/5rKf3nAN78g/dereferrer/?redirectUrl=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F11245767%2Fis-chrome-ignoring-cache-control-max-age>

But selecting the location bar and hitting 'enter' shows the desired
behaviour: The local browser cache is used.


Thanks
Jonathan Strampp


Am 24.04.19 um 10:17 schrieb Stian Thorgersen:
> Not sure why you are saying resources are not cached as they are. Just
> look at resources loaded by the default theme.
>
> On Tue, 23 Apr 2019 at 20:29, jo0815 <jo0815 at gmx.de
> <mailto:jo0815 at gmx.de>> wrote:
>
>     Hello,
>
>     I've been deveoping custom keycloak themes which is pretty straight
>     forward thanks to the provided documentation.
>     I am using version 4.8.3.Final.
>
>     Regarding caching I only see options for freemarker templates
>     caching in
>     standalon.xml, theme section.
>     Opening the network view in Firefox I notice that no caching
>     headers are
>     uses for statice resouces (img, css, js).
>     Thus every visit of the login page reloads all linked static resources
>     from the server.
>
>     So my question is:
>     How can I provide client side caching of static resources (perhaps by
>     etags with file content hash)?
>
>
>     Thanks
>     Jonathan Strampp
>
>
>     _______________________________________________
>     keycloak-dev mailing list
>     keycloak-dev at lists.jboss.org <mailto:keycloak-dev at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/keycloak-dev
>



More information about the keycloak-dev mailing list