diff options
Diffstat (limited to 'internal/server/index.go')
| -rw-r--r-- | internal/server/index.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/server/index.go b/internal/server/index.go index 6495f0ba0..0db06fc01 100644 --- a/internal/server/index.go +++ b/internal/server/index.go @@ -34,12 +34,15 @@ func ServeIndex(publicDir string) fasthttp.RequestHandler { return func(ctx *fasthttp.RequestCtx) { nonce := utils.RandomString(32, alphaNumericRunes) + ctx.SetContentType("text/html; charset=utf-8") ctx.Response.Header.Add("Content-Security-Policy", fmt.Sprintf("default-src 'self'; style-src 'self' 'nonce-%s'", nonce)) + err := tmpl.Execute(ctx.Response.BodyWriter(), struct{ CSPNonce string }{CSPNonce: nonce}) if err != nil { ctx.Error("An error occurred", 503) logging.Logger().Errorf("Unable to execute template: %v", err) + return } } |
