diff --git a/controllers/index.go b/controllers/index.go index 06b68d27d..46f682d78 100644 --- a/controllers/index.go +++ b/controllers/index.go @@ -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)) } diff --git a/router/middleware/disableFloc.go b/router/middleware/disableFloc.go new file mode 100644 index 000000000..9f6787dec --- /dev/null +++ b/router/middleware/disableFloc.go @@ -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=()") +}