[{"data":1,"prerenderedAt":118},["ShallowReactive",2],{"doc:\u002Fdocs\u002Fsdks\u002Fcloudflare-worker":3},{"page":4,"toc":103,"updated":117},{"path":5,"title":6,"seoTitle":7,"description":8,"blocks":9},"\u002Fdocs\u002Fsdks\u002Fcloudflare-worker","Cloudflare Worker proxy","Cloudflare Worker Proxy for the Browser SDK","Deploy a first-party proxy for the browser SDK in your own Cloudflare account. It forwards only identify requests, strips cookies and caps request bodies.",[10,13,18,24,27,68,71,89,92,99],{"type":11,"text":12},"p","The Worker proxy runs in your Cloudflare account on a path of your own site. It forwards only the browser SDK's identify and deferred-report requests, to the region your proxy key belongs to, and cannot read events.",{"type":14,"level":15,"text":16,"id":17},"heading",2,"Before you start","before-you-start",{"type":19,"items":20},"list",[21,22,23],"A Cloudflare account with your site's zone.","A [proxy key](\u002Fdocs\u002Fproxy-integrations#proxy-keys), `fly_px_…`, for the same environment as your public key.","Node.js and `pnpm`, to deploy with Wrangler.",{"type":14,"level":15,"text":25,"id":26},"Deploy","deploy",{"type":28,"steps":29},"steps",[30,42,53,59],{"title":31,"blocks":32},"Configure the Worker",[33,35],{"type":11,"text":34},"Copy `wrangler.toml.example` to `wrangler.toml`. Choose a neutral Worker name and route. Avoid words such as `fingerprint`, `tracking` or `fingerly` in the public path, which content blockers look for.",{"type":36,"samples":37},"code",[38],{"label":39,"lang":40,"code":41},"wrangler.toml","toml","name = \"edge-metrics\"\nmain = \"src\u002Findex.ts\"\ncompatibility_date = \"2026-09-01\"\nroutes = [{ pattern = \"shop.example.com\u002Fmetrics\u002F*\", zone_name = \"example.com\" }]\n\n[vars]\nFINGERLY_ROUTE_PREFIX = \"\u002Fmetrics\"\nFINGERLY_ALLOWED_ORIGINS = \"https:\u002F\u002Fshop.example.com,https:\u002F\u002Fexample.com\"",{"title":43,"blocks":44},"Add the proxy key",[45,51],{"type":36,"samples":46},[47],{"label":48,"lang":49,"code":50},"Terminal","bash","pnpm wrangler secret put FINGERLY_PROXY_KEY",{"type":11,"text":52},"Paste the proxy key when prompted. It is stored as an encrypted Worker secret.",{"title":25,"blocks":54},[55],{"type":36,"samples":56},[57],{"label":48,"lang":49,"code":58},"pnpm install\npnpm run deploy",{"title":60,"blocks":61},"Point the browser SDK at it",[62],{"type":36,"samples":63},[64],{"label":65,"lang":66,"code":67},"fingerly.ts","ts","const fingerly = await load({\n  apiKey: 'fly_pk_us_production_…',\n  endpoints: '\u002Fmetrics',\n  fallbackToDefaultEndpoint: true,   \u002F\u002F optional\n})",{"type":14,"level":15,"text":69,"id":70},"Configuration","configuration",{"type":72,"columns":73,"rows":77},"table",[74,75,76],"Name","Kind","Meaning",[78,82,86],[79,80,81],"`FINGERLY_PROXY_KEY`","Secret","Your proxy key. Its prefix decides which regional API the Worker forwards to.",[83,84,85],"`FINGERLY_ROUTE_PREFIX`","Variable","The path before `\u002Fapi\u002Fv1`. Must start with `\u002F`.",[87,84,88],"`FINGERLY_ALLOWED_ORIGINS`","Comma-separated exact origins allowed to call the Worker. A request from any other origin gets `403`.",{"type":14,"level":15,"text":90,"id":91},"What the Worker does","what-the-worker-does",{"type":19,"items":93},[94,95,96,97,98],"Answers CORS preflights for allowed origins, and only `POST` otherwise.","Forwards only `{prefix}\u002Fapi\u002Fv1\u002Fidentify` and `{prefix}\u002Fapi\u002Fv1\u002Fevents\u002F{request_id}\u002Fsupplement`; anything else gets `404`.","Refuses bodies over 1 MiB with `413` and gives Fingerly 5 seconds before answering `502`.","Sends the visitor's address from `CF-Connecting-IP`, the allowed origin and the user agent, authenticated with the proxy key.","Strips `Set-Cookie` from responses, never follows redirects, and never logs bodies or credentials.",{"type":100,"tone":101,"text":102},"callout","note","Forwarding only ever goes to `us.api.fingerly.io` or `eu.api.fingerly.io`, chosen by the proxy key. Your data stays in its region. Where Cloudflare processes the request at the edge is governed by your own Cloudflare account settings.",[104,105,106,109,111,113,115,116],{"id":17,"text":16,"level":15},{"id":26,"text":25,"level":15},{"id":107,"text":31,"level":108},"step-configure-the-worker",3,{"id":110,"text":43,"level":108},"step-add-the-proxy-key",{"id":112,"text":25,"level":108},"step-deploy",{"id":114,"text":60,"level":108},"step-point-the-browser-sdk-at-it",{"id":70,"text":69,"level":15},{"id":91,"text":90,"level":15},"2026-09-17T08:28:36.000Z",1789667797837]