custom css not loaded on first login attempt

76 views
Skip to first unread message

Manfredo Hopp

unread,
Oct 24, 2016, 3:32:19 PM10/24/16
to Cas
Hi: 

Trying to install a custom login page I noticed this strange behaviour with an apache front-end of cas 4.0.1. 

Here is my Cas properties file:

src/main/resources/cas-theme-default.properties: 

#standard.custom.css.file=/css/cas.css
standard.custom.css.file=/css/mydomain.css
cas.javascript.file=/js/cas.js

This new css is loaded only with a refresh of the browser.


Is there any issue regarding this behaviour?



Thanks!

Manfredo


Tom Poage

unread,
Oct 24, 2016, 5:00:38 PM10/24/16
to CAS Community
Don’t recall seeing cache-control in CAS itself (doesn’t mean it’s not there). We've been doing the following in httpd:

  <LocationMatch "\.(css|gif|jpg|png|js)$">
    <IfModule mod_expires.c>
      ExpiresActive On
      ExpiresByType text/css "access plus 1 hour"
      ExpiresByType image/gif "access plus 1 hour"
      ExpiresByType image/jpeg "access plus 1 hour"
      ExpiresByType image/png "access plus 1 hour"
      ExpiresByType text/javascript "access plus 1 hour"
      ExpiresByType application/javascript "access plus 1 hour"
    </IfModule>
  </LocationMatch>


Tom.

--
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAB623R9%2BNm42OSD5AZctPQ2w-mSNG%2BzzeJmOZtijDz_uEN%3D1uA%40mail.gmail.com.

Pascal Rigaux

unread,
Oct 24, 2016, 5:56:56 PM10/24/16
to cas-...@apereo.org
Hi,

When apache or tomcat serves static files, they add "Last-Modified" but no Expires nor Cache-Control.
In that cas browsers are using heuristics to know how long the file must be cached.
( http://stackoverflow.com/questions/14345898/what-heuristics-do-browsers-use-to-cache-resources-not-explicitly-set-to-be-cach )

Workaround for apache >= 2.4 : globally add the following on all apaches:

Header setifempty Cache-Control "max-age=86400" "expr=-n resp('Last-Modified') && -z resp('Expires')"


Anyway, AFAIK best solution for CAS is to use themes and versionize theme name (cache busting).

cu

On 24/10/2016 23:00, Tom Poage wrote:
> Don’t recall seeing cache-control in CAS itself (doesn’t mean it’s not there). We've been doing the following in httpd:
>
> <LocationMatch"\.(css|gif|jpg|png|js)$">
> <IfModulemod_expires.c>
> ExpiresActiveOn
> ExpiresByTypetext/css "access plus 1 hour"
> ExpiresByTypeimage/gif "access plus 1 hour"
> ExpiresByTypeimage/jpeg "access plus 1 hour"
> ExpiresByTypeimage/png "access plus 1 hour"
> ExpiresByTypetext/javascript "access plus 1 hour"
> ExpiresByTypeapplication/javascript "access plus 1 hour"
> </IfModule>
> </LocationMatch>
>
>
> Tom.

Manfredo Hopp

unread,
Oct 25, 2016, 9:10:16 AM10/25/16
to Cas
Hi, 

thanks for the replies.

Unfortunately I couldnt apply setIfEmpty since we have apache 2.4.6 and this is a feature of 2.4.7. Sorry I didnt mention apache's version.
The other suggestion on apache throwed same result (css not loaded at first attempt)

My workaround was eliminate springs c:url tag since it didnt resolve right. 

Thank you Manfredo
Reply all
Reply to author
Forward
0 new messages