apache: configure cache-control header
authorRalf Jung <post@ralfj.de>
Sun, 20 Nov 2022 12:19:20 +0000 (13:19 +0100)
committerRalf Jung <post@ralfj.de>
Sun, 20 Nov 2022 12:19:20 +0000 (13:19 +0100)
roles/apache/tasks/main.yml
roles/apache/templates/caching.conf [new file with mode: 0644]

index fee26efff5be7b765f1e34d53fd537d57f45ade8..6878845d87552c709d8c52abd25322272d01945c 100644 (file)
@@ -35,6 +35,7 @@
   - php5.conf
   - security.conf
   - defaults.conf
+  - caching.conf
   notify: apache
 - name: enable config files
   command: a2enconf {{ item }}
@@ -44,6 +45,7 @@
   - ssl
   - security
   - defaults
+  - caching
   notify: apache
 - name: disable config files
   command: a2disconf {{ item }}
diff --git a/roles/apache/templates/caching.conf b/roles/apache/templates/caching.conf
new file mode 100644 (file)
index 0000000..7880aec
--- /dev/null
@@ -0,0 +1,7 @@
+<FilesMatch "\.(gif|jpe?g|png|ico|js|css)$">
+    Header set Cache-Control "max-age=86400, public"
+</FilesMatch>
+
+<FilesMatch "\.html?$">
+    Header set Cache-Control "no-cache"
+</FilesMatch>