Skip to content

Instantly share code, notes, and snippets.

@andrewdalpino
Last active April 20, 2021 05:46
Show Gist options
  • Save andrewdalpino/91c8415e2e43bf3fc2b84dd82d450764 to your computer and use it in GitHub Desktop.
Save andrewdalpino/91c8415e2e43bf3fc2b84dd82d450764 to your computer and use it in GitHub Desktop.
Sets the Permissions-policy response header. By default, opt out of 'interest cohorts' a.k.a. targeted advertising.
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
class PermissionsPolicy
{
/**
* Handle the request and return a response.
*
* @param \Illuminate\Http\Request $request
* @param callable $next
*/
public function handle(Request $request, callable $next)
{
return $next($request)->header('Permissions-Policy', 'interest-cohort=()');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment