Skip to content

Commit

Permalink
Add Google FLoC opt-out header on web page requests. Closes #939
Browse files Browse the repository at this point in the history
  • Loading branch information
gabek committed Apr 16, 2021
1 parent dabc93e commit 8287484
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controllers/index.go
Expand Up @@ -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))
}

Expand Down
8 changes: 8 additions & 0 deletions 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=()")
}

0 comments on commit 8287484

Please sign in to comment.