Skip to content

Prerender content pages + harden client telemetry#31

Merged
pedropaulovc merged 1 commit into
mainfrom
perf/prerender-static-content
May 30, 2026
Merged

Prerender content pages + harden client telemetry#31
pedropaulovc merged 1 commit into
mainfrom
perf/prerender-static-content

Conversation

@pedropaulovc

Copy link
Copy Markdown
Contributor

Stacks the prerender perf work with two telemetry fixes.

Changes

  • Prerender static content pages and drop the client-side zod dependency (e9a39c8, c6ed36e).
  • Stop the client telemetry from sending cookies to App Insights (72f024d). navigator.sendBeacon forces credentials mode include with no opt-out, so it was replaying the third-party cookies the Azure ingestion endpoint sets (ai_user, browserId) on every /v2.1/track POST. Switched to a keepalive fetch with credentials:"omit" — survives unload, stays off the critical chain (priority:"low"), and carries no cookies.

Verification

  • Cookieless POST accepted by the ingestion endpoint (itemsAccepted, no Set-Cookie).
  • Real browser (system Chrome) on a preview build: /v2.1/track fires with no Cookie header, type: fetch, HTTP 200.
  • Preview deployment exercised end-to-end against the live Azure resource.

🤖 Generated with Claude Code

navigator.sendBeacon forces credentials mode "include" with no opt-out, so
it replayed the third-party cookies the Azure ingestion endpoint sets
(ai_user, browserId) on every /v2.1/track POST. Our envelopes carry their
own operationId/pageviewId, so a cookie is never needed for correlation.

Send via a keepalive fetch with credentials:"omit" instead — the modern
beacon equivalent that survives page unload (keepalive) and stays off the
critical request chain (priority:"low", the reason beacon was used before),
while being the only transport that lets us drop credentials.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 29, 2026 20:09
@pedropaulovc pedropaulovc enabled auto-merge May 29, 2026 20:10
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
decipher-ms 72f024d Commit Preview URL

Branch Preview URL
May 29 2026, 08:10 PM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens client telemetry by replacing navigator.sendBeacon with a low-priority keepalive fetch that omits credentials, preventing App Insights ingestion cookies from being replayed.

Changes:

  • Removes the sendBeacon transport path for telemetry.
  • Uses fetch with keepalive: true, credentials: "omit", and priority: "low" for telemetry POSTs.
  • Updates inline comments to document the cookie/transport rationale.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pedropaulovc pedropaulovc left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pedropaulovc pedropaulovc merged commit d97696a into main May 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants