Repository navigation
Cache Prebid placeholders briefly in the browser - #1734
Open
ChristianPavilonis wants to merge 2 commits into
Open
ChristianPavilonis wants to merge 2 commits into
ChristianPavilonis wants to merge 2 commits into
Conversation
Let a late script preload reuse the placeholder without making it shared-cacheable. The short lifetime limits how long a browser can reuse the placeholder after Trusted Server stops intercepting the publisher script URL.
ChristianPavilonis
marked this pull request as ready for review
December 4, 2026 17:03
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Next.js can load the publisher's Prebid script before hydration adds a preload for the same URL. With
no-store, Chrome fetches the Trusted Server placeholder again and warns that the preload went unused.Serve only the placeholder with
Cache-Control: private, max-age=60and no shared-cache headers. The real Prebid bundle is unchanged. If Trusted Server stops intercepting the script URL, a browser can still reuse a fresh placeholder until it expires.Why 60 seconds?
The preload arrived 800 ms after the script in the reproduction. A 60-second TTL let Chrome reuse the placeholder and eliminated the extra request and warning. We did not test shorter positive TTLs.
The placeholder is served at the publisher’s real Prebid URL. A longer TTL would give browsers more time to reuse the empty placeholder after Trusted Server stops intercepting that URL, delaying the return of the real script without helping the late preload.
privatekeeps the placeholder out of shared caches.Changes
crates/trusted-server-core/src/integrations/prebid.rsdocs/guide/integrations/prebid.mdCloses #1729
Spec
Not a feature.
Test plan
main, one network request and no warning with this patch.private, max-age=60and has no shared-cache headers.