Icinga Web 2 does currently not use a standardized way how to serve cachable content to the client.
This applies to gravatars, module images, CSS and JS.
I'd propose to fix and streamline this:
If done correctly, only the HTML served for a given url should be loaded from the server for all subsequent clicks until the maximum age expires.
Note that when using a maximum age for CSS, theme changes made by the client may only instantly visible in the window where the change has been made and only after one hour in other windows/tabs if the user does not request a new version. (Ctrl+F5) If this is not desired, CSS responses must not use maximum age.
@lippserd, @Thomas-Gelf What do you think?
Hi Johannes,
If JavaScript is enabled, clients do not request JavaScript or CSS after the initial page load. Adding a max age here would definitely hurt us because enabling and disabling modules and changing themes modifies the JavaScript and CSS which has to be served. The only issue I see here is, that our controller for static content does not send the appropriate caching headers.
Cheers,
Eric
@nilmerg, some thoughts:
ModuleController::imageAction(). Guess something changed at postDispatch time, at least the module makes a wrong assumption here. Should be fixed.Please also note that the Cache-control is part of the HTTP/1.1 specification and broadly supported by "modern" browsers. I think it is worth a shot to remove the Pragma and Expires header.
Created #2918 for the doc module issue
Okay, CSS and JS may indeed change too often/easily so that a max age would hurt us.
But static content hardly changes that often/easily that it is strictly necessary to have clients ask every single page load for the content. I can't see a reason that an expiration date would hurt us here.
But static content hardly changes that often/easily that it is strictly necessary to have clients ask every single page load for the content. I can't see a reason that an expiration date would hurt us here.
Absolutely. If I did not miss anything, this should already be in place:
Gravatar-Handling definitively needs improvement, should re-check the source from time to time etc - we should move this at least to a dedicated class, this is way too much logic for a controller action.
Most helpful comment
Hi Johannes,
If JavaScript is enabled, clients do not request JavaScript or CSS after the initial page load. Adding a max age here would definitely hurt us because enabling and disabling modules and changing themes modifies the JavaScript and CSS which has to be served. The only issue I see here is, that our controller for static content does not send the appropriate caching headers.
Cheers,
Eric