Created
April 19, 2021 10:54
-
-
Save multiversecoder/fe300a8918d176762507ec1657393e7b to your computer and use it in GitHub Desktop.
How To Disable Google's FLoC | Ruby on Rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an Example on how to disable Google's FLoC using a 3 lines rails method | |
# setting the new "Permission-Policy" response header | |
# | |
# To disable Google's FLoC and Opt-Out from this security threat, | |
# just paste this code from line 12 to line 17 inside your application's | |
# app/controllers/application_controller.rb | |
# | |
class ApplicationController < ActionController::Base | |
# ... | |
after_action :nofloc | |
# disable Google's FLoC on Rails with "Permission-Policy" => "interest-cohort=()" | |
def nofloc | |
response.set_header 'Permission-Policy', 'interest-cohort=()' | |
end | |
# ... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment