My webpages on my website may appear static to the user, but they're actually dynamic since data is retrieved from a database and may be changed at anytime. Additionally, users may customize some preferences and that also changes the output as well.
At this present time, I have set the client side caching to nothing with the following HTTP headers:
Expires: Sat, 01 Jan 2000 00:00:00 GMT Pragma: no-cache Cache-control: private, no-cache, no-store, must-revalidate
I also added a
connection: close since the assets to the page are from a different subdomain.
For some reason, I feel there could be more optimal values for cache-control and expires. I also feel I could use etag validation but I'm not 100% sure. I want to use optimal values based on the worst-user perspective. and I think the worst user may consist of hitting the refresh button 100 times a minute.
I know for sure if I set the caching values too high, then when users choose customized settings (aka cookie value changes), they will have to refresh the browser or wait the number of seconds the cache is set for in order for the settings to take effect. With no caching set, the customized settings can be saved immediately.
I'm just trying to strike the right balance.
Should I enable caching, and if so, how long? and have other dynamic sites enabled caching for their dynamic html pages?