Reevaluate and update firewall core logic

This commit is contained in:
Daniel
2019-02-22 16:18:58 +01:00
parent d28ed664aa
commit f7a07cbb2f
39 changed files with 1469 additions and 915 deletions

View File

@@ -103,6 +103,7 @@ func ServeFileFromBundle(w http.ResponseWriter, r *http.Request, bundleName stri
return
}
// set content type
_, ok := w.Header()["Content-Type"]
if !ok {
contentType := mime.TypeByExtension(filepath.Ext(path))
@@ -111,6 +112,9 @@ func ServeFileFromBundle(w http.ResponseWriter, r *http.Request, bundleName stri
}
}
// set content security policy
w.Header().Set("Content-Security-Policy", "default-src 'self'")
w.WriteHeader(http.StatusOK)
if r.Method != "HEAD" {
_, err = io.Copy(w, readCloser)