summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-03-11 10:29:40 -0500
committerOmar Roth <omarroth@hotmail.com>2018-03-11 10:29:40 -0500
commitd664d6b371c02aa9fa8bed8bf5fe736abb4f7e00 (patch)
tree2914fe9ae1fcfbd766e064ce30e2054697cdb818
parent31d1315c60e4900e2d98901725ecaebc7dd96f51 (diff)
downloadinvidious-d664d6b371c02aa9fa8bed8bf5fe736abb4f7e00.tar.gz
invidious-d664d6b371c02aa9fa8bed8bf5fe736abb4f7e00.tar.bz2
invidious-d664d6b371c02aa9fa8bed8bf5fe736abb4f7e00.zip
Only use HSTS if SSL is enabled
-rw-r--r--src/invidious.cr8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 139c25ae..cbc1fe11 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -160,10 +160,6 @@ get "/" do |env|
templated "index"
end
-before_all do |env|
- env.response.headers.add("Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload")
-end
-
get "/watch" do |env|
if env.params.query["v"]?
id = env.params.query["v"]
@@ -356,6 +352,10 @@ if Kemal.config.ssl && redirect
server.listen
end
+
+ before_all do |env|
+ env.response.headers.add("Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload")
+ end
end
static_headers do |response, filepath, filestat|