79307766

Date: 2024-12-25 14:32:17
Score: 2
Natty:
Report link

@Danish Javed have you fixed the issue yet?

I wrote a blog post on this. The gist of the article are three possible fixes:

Fix 1: Remove the attribution-reporting Directive

If your application does not rely on attribution-reporting, simply remove it from the Permissions-Policy header in your server or hosting configuration.

Fix 2: Ensure Compatibility with Browser Support

If you intend to use attribution-reporting, ensure that your app consider cross-browser quirks. Check for browser support using req.headers['user-agent'] and conditionally add the header:

const userAgent = req.headers['user-agent'];
if (userAgent.includes('Chrome/')) {
  res.setHeader("Permissions-Policy", "attribution-reporting=()");
}

Fix 3: Update or Configure Dependencies

If the header is being added by a dependency (e.g., a library or hosting provider), update the dependency or override its configuration. If you're using Vercel, you might want to use a vercel.json file:

{
    "headers": [
      {
        "source": "/(.*)",
      "headers": [
          {
            "key": "Permissions-Policy",
          "value": "geolocation=(), microphone=()"
        }
      ]
    }
  ]
}
Reasons:
  • RegEx Blacklisted phrase (1.5): fixed the issue yet?
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @have
  • Low reputation (0.5):
Posted by: schmark