From e151fbfdaa1887b581757d9408c4252491b52159 Mon Sep 17 00:00:00 2001 From: Alexander Reinert Date: Thu, 18 Jan 2018 12:08:28 +0100 Subject: [PATCH] Add Cache-Control header to JS and CSS requests to avoid aggresive caching --- .../packages/lighttpd/etc/lighttpd/conf.d/headers.conf | 7 +++++++ arm-gnueabihf/packages/lighttpd/etc/lighttpd/lighttpd.conf | 6 ++++++ .../packages/lighttpd/etc/lighttpd/lighttpd_ssl.conf | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 arm-gnueabihf/packages/lighttpd/etc/lighttpd/conf.d/headers.conf diff --git a/arm-gnueabihf/packages/lighttpd/etc/lighttpd/conf.d/headers.conf b/arm-gnueabihf/packages/lighttpd/etc/lighttpd/conf.d/headers.conf new file mode 100644 index 00000000..a13ee17e --- /dev/null +++ b/arm-gnueabihf/packages/lighttpd/etc/lighttpd/conf.d/headers.conf @@ -0,0 +1,7 @@ +# Avoid aggressive caching of JS and CSS. Max-Age is for Firefox that ignores the must-revalidate +$HTTP["url"] =~ "^/webui/.*\.(js)|(css).*" { + setenv.add-response-header += ( + "Cache-Control" => "public, must-revalidate, max-age=30" + ) +} + diff --git a/arm-gnueabihf/packages/lighttpd/etc/lighttpd/lighttpd.conf b/arm-gnueabihf/packages/lighttpd/etc/lighttpd/lighttpd.conf index 145aeff7..118f02d5 100755 --- a/arm-gnueabihf/packages/lighttpd/etc/lighttpd/lighttpd.conf +++ b/arm-gnueabihf/packages/lighttpd/etc/lighttpd/lighttpd.conf @@ -157,6 +157,12 @@ include "conf.d/access_log.conf" ## include "conf.d/debug.conf" +## +## The header options are moved into their own file. +## see conf.d/headers.conf for various options for additional response headers. +## +include "conf.d/headers.conf" + ## ####################################################################### diff --git a/arm-gnueabihf/packages/lighttpd/etc/lighttpd/lighttpd_ssl.conf b/arm-gnueabihf/packages/lighttpd/etc/lighttpd/lighttpd_ssl.conf index d65b6ef5..54da9ea3 100755 --- a/arm-gnueabihf/packages/lighttpd/etc/lighttpd/lighttpd_ssl.conf +++ b/arm-gnueabihf/packages/lighttpd/etc/lighttpd/lighttpd_ssl.conf @@ -157,6 +157,12 @@ include "conf.d/access_log.conf" ## include "conf.d/debug.conf" +## +## The header options are moved into their own file. +## see conf.d/headers.conf for various options for additional response headers. +## +include "conf.d/headers.conf" + ## #######################################################################