-
Notifications
You must be signed in to change notification settings - Fork 8
Add Prebid.js NPM integration with per-module JS builds #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aram356
wants to merge
4
commits into
main
Choose a base branch
from
feature/prebid-npm-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
- Add `Proxy.certificate_check` setting (defaults to true for secure production) - Add `compute_host_header()` to properly format Host header with non-standard ports - Extend `ensure_origin_backend()` with certificate_check parameter - Include cert setting in backend name to avoid reusing backends with different settings - Add comprehensive tests for port preservation in proxy signing and HTML rewriting - Update all call sites to pass certificate_check=true (secure default) This fixes an issue where backends behind reverse proxies would generate URLs without the port when the Host header didn't include it.
- Add prebid.js ^10.18.0 as a dependency - Add prebid integration module that configures Prebid for server-side bidding - Configure s2sConfig to route bid requests through Trusted Server's /ad/auction endpoint - Include required Prebid modules: prebidServerBidAdapter, consentManagement, consentManagementGpp The integration: - Sets up server-side bidding with dynamic bidder discovery - Routes all bid requests through the Trusted Server proxy - Auto-configures Prebid on module load
5 tasks
Base automatically changed from
feature/cert-verification-port-handling
to
main
February 9, 2026 19:42
fed073e to
a9569b6
Compare
Collaborator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, currently isn't working for me, I get bids back from trusted server but nothing renders and I get this error:
ERROR: Trying to make a request for bidder that does not exist: mocktioneer
I'm not sure if there's more setup I need or if this isn't 100% done yet.
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
Replaces the old Prebid extension shim (
ext/prebidjs.ts) with a full NPM-bundled Prebid.js integration and introduces per-module JS builds with runtime concatenation.Prebid.js NPM Integration
prebid.js ^10.18.0directly (replaces the old shim that expected a publisher-providedpbjsglobal)trustedServerbid adapter that routes all bid requests through the/auctionorchestrator endpointpbjs.requestBids()to inject thetrustedServerbidder into every ad unit automaticallyaccount_id,timeout,debug,bidders) injected viawindow.__tsjs_prebidfromtrusted-server.tomltrustedServerbidder placeholder to real PBS bidders (e.g.,mocktioneer) before forwarding to Prebid ServerPer-Module JS Build Pipeline
tsjs-core.js,tsjs-prebid.js,tsjs-creative.js, etc.)build-all.mjsscript replaces the single Vite build, building core + each integration in parallelbuild.rsauto-discoversdist/tsjs-*.jsfiles and generatestsjs_modules.rswithinclude_str!()for eachIntegrationRegistryconfig/static/tsjs=tsjs-unified.min.js?v=<hash>for backward compatibilityAuction Flow (Browser → Server → PBS)
trustedServeradapter →POST /auction(AdRequest format)handle_auction→AuctionOrchestrator→PrebidAuctionProvidertrustedServer→ configured biddersPOST {server_url}/openrtb2/auction→ Prebid ServerCore JS Cleanup
getAllCodes,isArray,renderCreativeIntoSlot,writeHtmlToIframeConfig→config.ts,RequestAdsCallback/RequestAdsOptions→request.tsRequestModeenumtypes.tsnow only contains the public API contract (TsjsApi,AdUnit,Size)Key Files Changed
crates/js/lib/src/integrations/prebid/index.ts(new)crates/js/lib/src/core/auction.ts(new),request.tsbuild-all.mjs(new),build.rs,bundle.rs,vite.config.tsregistry.rs(js_module_ids()),tsjs.rs,html_processor.rs,publisher.rsprebid.rs(head injector, bidder expansion, logging)ext/prebidjs.ts,ext/index.ts,ext/types.tsBundle Size Impact
Publishers without Prebid: ~15KB (core only, down from ~218KB unified)
Publishers with Prebid: ~215KB (core + prebid module, similar to before)
Test plan
npx vitest run— 148 JS tests pass (16 test files)cargo test --workspace— 353 Rust tests passnpm run build— 8 module files produced indist//auctionrequest fires on live pagetsjs-prebid.jsCloses #250
Related to #179