When web2py serves static files, it does set the Last-Modified header, but 
I'm not sure that's enough to prompt an If-Modified-Since request -- we may 
need to add a max-age=0 and/or must-revalidate directive as well.

Anthony

On Thursday, May 10, 2012 3:54:54 PM UTC-4, Derek wrote:
>
> I think the second option is the better one. Even better would be to 
> support the If-Modified-Since or use ETAG.
>
> On Thursday, May 10, 2012 11:36:01 AM UTC-7, Niphlod wrote:
>>
>> Expiring headers wouldn't be smart.... what if you changed the html 
>> trusting that the new javascript will be fetched instead of the cached one ?
>> Or, you choose to set expire headers 2 days in the future, and you need 
>> to make a change to the code, but need to wait 2 days to wait for 
>> expiration.....
>> the only solution is versioning static files.....
>>
>> e.g. /static/js/1.2.3/mysnippet.js vs /static/js/1.2.4/mysnippet.js
>> or
>> /static/js/mysnippet.js?ver=1.2.3 vs /static/js/mysnippet.js?ver=1.2.4
>>
>>
>>
>> Il giorno martedì 8 maggio 2012 21:25:26 UTC+2, Derek ha scritto:
>>>
>>> That would fix it for the one system - but if you have site that is used 
>>> by many, are you going to have everyone empty their cache? Isn't there a 
>>> way to set the cache headers?
>>>
>>> On Tuesday, May 8, 2012 10:34:30 AM UTC-7, Anthony wrote:
>>>>
>>>> It's probably being cached by the browser, so you may need to clear the 
>>>> browser cache (simply refreshing the page won't do it).
>>>>
>>>> Anthony
>>>>
>>>> On Tuesday, May 8, 2012 1:11:51 PM UTC-4, monotasker wrote:
>>>>>
>>>>> I'm working on a js file that resides in appname/static/js/ but for 
>>>>> some reason it seems to be cached. When I refresh the browser (even if I 
>>>>> restart the local web2py server) the page continues to load an old 
>>>>> version. 
>>>>> I develop largely with custom modules, and those files are refreshing 
>>>>> just 
>>>>> fine. I have this in my db.py model file:
>>>>>
>>>>> from gluon.custom_import import track_changes
>>>>> track_changes(True)
>>>>>
>>>>> But for some reason this javascript file doesn't want to refresh. Any 
>>>>> suggestions?
>>>>>
>>>>> Ian
>>>>>
>>>>

Reply via email to