about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/app.js b/src/app.js
index 46ebd2e..fa0d5c2 100644
--- a/src/app.js
+++ b/src/app.js
@@ -3,6 +3,8 @@
 const Koa = require('koa')
 const app = new Koa()
 
+const helmet = require('koa-helmet')
+
 const actions = require('./actions.js')
 
 const config = require('./modules/config.js')
@@ -26,6 +28,14 @@ for (let [term, items] of Posts.taxonomies) {
   )
 }
 
+app.use(
+  helmet({
+    hsts: {
+      setIf: ctx => ctx.secure
+    }
+  })
+)
+
 app.use(router.routes()).use(router.allowedMethods())
 
 app.use(actions.serveFiles)