How to Bypass Adblockers with Fingerprint and Cloudflare
Context
While building SkySculptor, an immersive AI-powered interface that transforms weather data into living visual sculptures, I implemented a fingerprint-based rate limiting system to prevent API abuse. I chose Fingerprint.js Pro for its ability to identify users even after cookie deletion.
The Problem
During early testing, an error appeared in the console:
FPJSAgentError: Failed to load the JS script of the agent
After investigation, the culprit was uBlock Origin — the extension I use daily myself. Adblockers maintain blacklists of tracking domains, and Fingerprint's CDNs (fpjscdn.net, fpjs.io) are on those lists.
Why Does It Work on fingerprint.com?
While inspecting Fingerprint's website, I noticed their demo worked perfectly despite uBlock. Looking at the Network tab:
- No calls to
fpjscdn.net - Requests went through a custom subdomain (
metrics.fingerprint.com)
Adblockers don't block what looks like first-party traffic!
Solution 1: Next.js Rewrites (Failed)
My first attempt was configuring rewrites in Next.js to proxy the requests:
// next.config.ts
rewrites() {
return [
{
source: "/_fp/agent/:path*",
destination: "https://fpjscdn.net/v3/:path*",
},
{
source: "/_fp/api/:path*",
destination: "https://eu.api.fpjs.io/:path*",
},
];
}