Bug #40754
mgr/dashboard: configure HTTP caching for static files (JS/Angular)
0%
Description
A Rook issue might be (still under investigation) caused by a long-term caching of JS assets (dashboard Angular front-end) causing an older version of the front-end to interact with a newer Python back-end. Regardless any discussions on backward compatibility, this behaviour should be reviewed. According to RFC7234, in the absence of cache control headers, it should be assumed that web browsers and HTTP proxies can unconditionally cache contents. Last-Modified
headers (added by default by CherryPy) should result in some cache revalidation (10%) but it seems that's not enough.
Hence the recommendation is to set Cache-Control
headers. Let's use this issue to experiment and discuss the specific settings:
- no-cache
would trigger cache revalidation for every request, so perhaps having a small max-age
could work better.
History
#1 Updated by Ernesto Puerta over 4 years ago
- Description updated (diff)
#2 Updated by Ernesto Puerta over 4 years ago
On production builds the generate filenames are like (taken from Rook 1.0.3):
2.4da8e9a1b5fdced61b82.js 3rdpartylicenses.txt 6.e4b23fcd914a85f0c9d4.js 7.3b24fc1c593d1108bbba.js 8.8593d96b9d36803cce1d.js 9.3fb8208906cbb24d5c92.js assets/ Ceph_Logo_Stacked_RGB_120411_fa_228x228.1ed169ccc35367a2dab2.png common.f2fa8853754150cac770.js favicon.ico forkawesome-webfont.35e77a38ca9d85c4e897.eot forkawesome-webfont.3a9e014c2469ffa65a0e.woff2 forkawesome-webfont.44bbdbbfb5a10ba2d1ce.woff forkawesome-webfont.78dcc9c4999659b8026a.svg forkawesome-webfont.fc46f3dae03b2b2e1cee.ttf glyphicons-halflings-regular.448c34a56d699c29117a.woff2 glyphicons-halflings-regular.89889688147bd7575d63.svg glyphicons-halflings-regular.e18bbf611f2a2e43afc0.ttf glyphicons-halflings-regular.f4769f9bdb7466be6508.eot glyphicons-halflings-regular.fa2772327f55d8198301.woff index.html main.81b955ec57643ec040cc.js polyfills.d8aeed9792a464f7419c.js prometheus_logo.074db273ef932a67d91b.svg runtime.e555cff9ed94e9c9f3d4.js scripts.fc88ef4a23399c760d0b.js styles.f60c3133717be9029c60.css
From the above, only index.html
, glyphicons-*
, favicon.ico
remain the same, but if we have a closer look at index.html
we can see that it's pointing to 2 hardcoded assets (runtime.*.js
and styles.*.css
). That means that index.html
needs to be revalidated each time the dashboard is loaded. All other resources can be heavily cached though.
#3 Updated by Ernesto Puerta almost 3 years ago
- Project changed from mgr to Dashboard
- Category changed from 132 to General