Forum

Caching TTL not reliable

alexpacio
3 May 2016, 12:27
Hi,
on Hiawatha 10.2, even if it force Hiawatha to cache files like jpg, css, etc. with the directive:
Directory {
DirectoryID = expire
Path = /
Extensions = css, eot, gif, jpeg, jpg, png, ttf, ico
ExpirePeriod 1 week
}

and I recall it in my VirtualHost like this:

UseDirectory = expire

It seems that files are cached up to 60 seconds, and not for the ExpirePeriod that I provided.

Why?
Hugo Leisink
3 May 2016, 15:02
Please verify that the expire header is set for those files. Where did you get the 60 seconds?
alexpacio
3 May 2016, 16:28
How could I set the expire header?

I got 60 seconds by Tomawahk's "show cache"
Hugo Leisink
3 May 2016, 17:37
That's Hiawatha's internal cache. That's totally different from the browser's cache, which is set via the Expire header.
alexpacio
4 May 2016, 12:54
HTTP/1.1 200 OK
Date: Wed, 04 May 2016 10:54:31 GMT
Server: EmpulseWebServer
Connection: keep-alive
Transfer-Encoding: chunked
X-Powered-By: PHP/5.6.20
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: frontend=fbmq09flksgjdv1h9fvi34s1b4; expires=Wed, 04-May-2016 13:54:31 GMT; Max-Age=10800; path=/; domain=www.dope-factory.com; httponly
Content-Type: text/html; charset=UTF-8
X-Frame-Options: SAMEORIGIN
Age: 2357

Is it possibile to keep those file in Hiawatha's internal cache for a longer time? Could I gain in performances?

Why it says that expires on Thu, 19 Nov 1981 08:52:00 GMT while I set 1 week of exipiring in Hiawatha?
Hugo Leisink
4 May 2016, 18:18
That Expires header is not set by Hiawatha, but by the CMS / framework you are using. If Hiawatha sees a Expires header in the CGI output, it will not set one.
alexpacio
5 May 2016, 14:51
Why can't I rewrite the Expires header on the webserver side?
I would like to configure them as of my needs, without changing the CMS behaviour.

If i'm not wrong, Apache's mod_expires can do this.
Hugo Leisink
5 May 2016, 20:15
There is probably a good reason why the CMS sets the Expires header that way. You want to change it? Change it at the source, change it in the CMS.
This topic has been closed.