Add security headers

This commit is contained in:
Omar Roth 2019-09-04 22:05:25 -04:00
parent 798b2c282f
commit 047d53bfb1
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

View File

@ -81,6 +81,13 @@ spawn do
end
end
before_all do |env|
env.response.headers["X-XSS-Protection"] = "1; mode=block"
env.response.headers["X-Content-Type-Options"] = "nosniff"
env.response.headers["Referrer-Policy"] = "same-origin"
env.response.headers["Strict-Transport-Security"] = "max-age=31536000; includeSubDomains; preload"
end
get "/" do |env|
sort_by = env.params.query["sort_by"]?
sort_by ||= "users-reverse"