0

Add Google FLoC opt-out header on web page requests. Closes #939

This commit is contained in:
Gabe Kangas 2021-04-15 22:17:52 -07:00
parent dabc93ef03
commit 8287484cc6
2 changed files with 11 additions and 0 deletions

View File

@ -64,6 +64,9 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) {
// Set a cache control max-age header
middleware.SetCachingHeaders(w, r)
// Opt-out of Google FLoC
middleware.DisableFloc(w)
http.ServeFile(w, r, path.Join(config.WebRoot, r.URL.Path))
}

View File

@ -0,0 +1,8 @@
package middleware
import "net/http"
// DisableFloc will tell Google to not use this response in their FLoC tracking.
func DisableFloc(w http.ResponseWriter) {
w.Header().Set("Permissions-Policy", "interest-cohort=()")
}