Skip to content

Commit

Permalink
feat: add security headers
Browse files Browse the repository at this point in the history
  • Loading branch information
GalvinGao committed Oct 12, 2022
1 parent befff2b commit 97a24b2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ func main() {
return c.SendStatus(fiber.StatusBadRequest)
}

c.Set("Content-Type", "text/html; charset=utf-8")
c.Set("Cache-Control", "public, max-age=86400")
c.Set("Vary", "Accept-Encoding")
c.Set("Content-Security-Policy", "default-src 'none'; sandbox") // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox
c.Set("X-Content-Type-Options", "nosniff")
c.Set("X-Frame-Options", "DENY")
c.Set("X-XSS-Protection", "1; mode=block")

return tmpl.Execute(c, fiber.Map{
"pkg": pkg,
})
Expand Down

0 comments on commit 97a24b2

Please sign in to comment.