summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-02-26 02:45:02 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-02-26 02:50:19 +0100
commitfaaaacfce6941438e5911dc9c207208213f211b4 (patch)
tree7032abbea75cdf1c9b9a923e9e3ee3f1cb73c30f /src
parentfb83347738877d0c9f9d2a60a52f77517b530ac5 (diff)
Add Cache-Control: no-cache to the default response headers.
Diffstat (limited to 'src')
-rw-r--r--src/mulk/benki/main.clj8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mulk/benki/main.clj b/src/mulk/benki/main.clj
index 09def98..2135b6f 100644
--- a/src/mulk/benki/main.clj
+++ b/src/mulk/benki/main.clj
@@ -26,9 +26,17 @@
(hiccup.core/with-base-url base-uri
((noir.options/wrap-options handler {:base-url base-uri}) request)))))
+(defn wrap-cache-control [handler]
+ (fn [request]
+ (let [response (handler request)]
+ (if (get-in response [:headers "Cache-Control"])
+ response
+ (assoc-in response [:headers "Cache-Control"] "no-cache")))))
+
(do-once ::init
(noir.server/add-middleware #(wrap-utf-8 %))
(noir.server/add-middleware #(wrap-base-uri %))
+ (noir.server/add-middleware #(wrap-cache-control %))
(noir.server/add-middleware #(ring.middleware.file/wrap-file % "static")))
(defonce server (doto (Thread. #(noir.server/start (:web-port @benki-config)))