Author Topic: Successful cache header for images, similar to .htaccess  (Read 651 times)

0 Members and 1 Guest are viewing this topic.

Offline danny

  • Regular poster
  • **
  • Posts: 28
    • View Profile
Successful cache header for images, similar to .htaccess
« on: May 01, 2018, 12:11:44 AM »
in hfs.events (alt+f6)

[+request]
{.if|{.match|*.gif;*.ico;/*img*|%url%.}|{:{.add header|Cache-Control: public, max-age=31536000.}{.add header|Vary: Accept-Encoding.}:}.}

This is functionally similar to Apache .htaccess
Only the file extensions specified have been cached by the browser.

Tip:
If you decide to cache a wider variety of file extensions, it may be useful to add the reversal command {.add header|Cache-Control: no-cache, max-age=0.} into the template at the [error-page] section, so as to reduce persistence of redirects.
« Last Edit: May 17, 2018, 11:04:05 AM by danny »