Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

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

Gabe Kangas27203e17eca7
diff --git a/controllers/index.go b/controllers/index.go
index 06b68d27d0..46f682d785 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 0000000000..9f6787dec2
--- /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=()")
+}