Cloud Site Issue

Peter Zaal peter.zaal at gmail.com
Tue Aug 14 22:16:33 PDT 2018


On Wed, Aug 15, 2018 at 3:56 AM Dirk Hohndel <dirk at hohndel.org> wrote:

>
> Are there ways to mark things on the server so that the browsers don’t
>> cache the .js files that we send? Because that’s the #1 source of user
>> problems - old versions of files in the browser cache.
>
>
> A pretty quick solution would be to configure the Apache server. We just
> need to send the proper caching headers (specifically, we need apache to
> send the *no-cache *header, the browser will handle the rest).
>
> *One method to do so here:*
>
> Add a .htaccess file to the root of the web directory, and add the
> following:
>
> <FilesMatch "^(list_lib|jquery.min)\.js$">
> Header set Cache-Control "no-cache"
> Header set Pragma "no-cache"
> </FilesMatch>
>
> To add more files to the caching rule, just add them in the parens above,
> separated by a pipe.
>
> If you want to do it for all of the files just use:
>
> <FilesMatch "\.(html|js|css)$">
>         ...
> </FilesMatch>
>
> Happy to discuss further or help implement on the server. My one concern
> about the above approach is how does the stat.js file get created? Is it
> made on request? Or is it updated in some sort of user directory each time
> the server gets a cloud sync? If it's made on request, we'll just need to
> make sure the response handler is also giving the no-cache header.
>
>
> The files are created on every push to a user's repo, but are otherwise
> static.
>

Just to mention another solution is to add a query parameter with a random
value at the url, e.g. ....\myscript.js?t=<random number>
Either with an random number for every request, or have the number changed
only with every update of the script. The latter is the best since this
will allow the browser to get the script only the first time and use it
from cache the next times.

Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20180815/bae47984/attachment.html>


More information about the subsurface mailing list