expires, cache header for images, css, etc

18 July 2014, 21:30

Hiawatha version: 9.6
Operating System: Centos 6.5

After converting our main site to Hiawatha, no reverse proxy, we started getting lower grade performance ratings on Yslow and GTmetrix, as well as others.

These all stem from no cache expires headers being added to images, fonts, etc. This was all handled through .htaccess using apache mod_expires.

It appears hiawatha has no easy way to do this at all. Url rewriting images and other fiketypes to a php scriot to add headers is a poor solution.

Suggestion. And should be rather easy to impkement since you send mime type headers already. In the mime.conf file allow a option to set expires headers. For example:

mime file/type 300

This would set an expires header of 300 seconds to that mime type. Add the expire header when ever this is specified in the mime configuration file.

This shouldn't be too much additional code. Please consider, or something of this nature.

Thank you Hugo, I absolutely love hiawatha. It is truly the best webserver I have used.
Hugo Leisink
18 July 2014, 23:39
Sounds doable. But on the other hand, how much is this going to matter in real life. All browsers have quite good caching. The expire header is not required for that. Sure, it's making things more clear for browsers, but without it, they'll cache images and stylesheets anyway. I have no problem with implementing this feature. But how much are these Yslow and GTmetrix tools only showing a theoratical issue?
19 July 2014, 00:26
I agree, and 'we' know that the browser is caching images, etc. My concern is the clients that we serve. Webmasters want the fastest servers, secure everything, etc, etc. I can already see the problems Yslow and GTmetrix will have when we update all our production servers to 'hiawatha only'.

Since expires header is common, it is 'recommended' by everyone, the option would be very nice in hiawatha. I figured it wouldn't be too hard to implement, and it would give people peace of mind knowing what we already know, it's cached

Again, thank you Hugo.
Hugo Leisink
19 July 2014, 00:57
I'll take a look at it. But again, not very soon due to coming vacation.
19 July 2014, 03:41
No need for this feature, after reading manual pages I fixed the scores on GTmetrix and Yslow with one line in our urltoolkit.

Match \.(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3|ttf|eot|svg|pdf)$ Expire 1 months

So no need to even consider this, Hiawatha already does easily!
Hugo Leisink
19 July 2014, 07:23
Yes, I know. I guess I read your first post too quickly. Saw something about URL rewriting, so I thought that the UrlToolkit was not what you were looking for. Sorry.
This topic has been closed.