-
Notifications
You must be signed in to change notification settings - Fork 0
Traffic Server Caching
Apache Traffic Server is a service that caches html pages on our dev, stg and liv sites. It works a level above the web server and Django.
You sometimes may need to clear the cache if you received old version of the html pages but you have since updated the site.
sudo -- sh -c 'service trafficserver stop && traffic_server -C clear && service trafficserver start'
TrafficServer caches content and response headers from web server and use that to determine when to request a new version.
See logic here:
In practice, it seems that with our default configuration the static files are cached for 10% of the period between the file timestamp on disk and the last time the timestamp was checked by TS. So if an asset hasn't been updated for a year, a new version may not be requested for up to a month after its deployment (even if TS has been restarted or its cache cleared recently). That's why it's best to always clear the cache after any live deployment, especially after any package upgrade (Wagtail, Django).
To prevent caching a specific path, add the following the rule to /etc/trafficserver/cache.config :
url_regex=/search.* action=never-cache
(Note, examples in trafficserver doc wrongly include the domain in the regex, it should only use the webpath)
It seems that by default wagtail only returns the 'Date' in the response header.