Project

General

Profile

Browser cache control

Added by Stas Magill almost 11 years ago

Hi,

Has anyone ever tried or managed to disable the browser cache from Wt? I couldn't find any way of doing this, but looking this up on the web suggests using HTML "meta" tags:

Wt does not appear to provide any direct method to add things into the page header, but it does have WApplication::addMetaHeader() which sounds ideal, but does not work in our setup. I have tried enabling "progressive bootstrap" mode, but that breaks our site visually because the whole site ends up in an HTML table where the height of the first row is incorrect. We are currently using Wt 3.2.3.

Any ideas from anyone?

Thanks,

Stas.


Replies (3)

RE: Browser cache control - Added by Wim Dumon almost 11 years ago

Hello Stas,

Wt always disables caches for dynamic content (the application itself), but does enable caching for the static files it serves. This is currently not configurable, but we may accept a patch which makes this configurable.

The code is in src/http/StaticReply.C, around line 136 (search for Cache-Control). If modify that code to always set 'no-cache', you should have the desired behaviour.

BR,

Wim.

RE: Browser cache control - Added by Stas Magill over 10 years ago

Hi guys,

Wim, your solution initially appeared to work (thanks for that), but now this problem is re-appearing occasionally. It's causing problems with customers upgrading to the latest version and sometimes CSS and bitmap changes are getting ignored by the browsers. We are using Wt3.3.0 and apply the attached patch file to disable the cache, but certainly in Chrome this doesn't always work. I have two test installers with different bitmaps for one of our graphics. Sometimes after an install the browser shows the wrong bitmap. Clearing the Chrome cache and refreshing seems to be the only way to get the correct bitmap to appear. Is there some other way to disable the caching?

Thanks,

Stas.

RE: Browser cache control - Added by Wim Dumon over 10 years ago

Stas,

Can you identify the request in your browser that sends the wrong cache headers? Looking at the headers there could show the cause of the problem...

Maybe the 304 (not modified) path in staticreply is taken?

The 'Expires' header seems to contradict the 'Cache-Control: no-cache' header. Eliminate Expires?

In chrome, go to about:cache and take a look at how the browser remembers the file.

BR,

Wim.

    (1-3/3)