Skip to content

Prebid 12: send bid, user ID and RTD requests without CORS preflight (text/plain JSON, no custom headers, enforced by core) #16293

Open

Description

@patmmccann

🤖 This issue was written by an AI agent (Claude Code) on behalf of @patmmccann.

Problem

A cross-origin request with Content-Type: application/json or a non-safelisted header (e.g. X-Openrtb-Version) makes the browser send an OPTIONS preflight and wait for the answer before the real request goes out. That preflight costs about as long on the network as the request itself.

@pm-harshad-mane measured the cost in DevTools in #12948 and explained it in Optimizing cross-origin requests: avoiding CORS preflight. Thanks to him for raising it and doing the measuring.

Core already sends JSON bodies as text/plain for this reason, but modules can still override it:

  • Bid adapters: the cost comes out of the bidder's own timeout.
  • User ID modules behind auctionDelay, and RTD providers with waitForIt: true: the preflight delays the whole auction for every bidder. Every RTD provider below recommends waitForIt: true in its docs (1plusX, Goldfish Ads, Scope3, Symitri, Semantiq), and myGaru recommends auctionDelay.

Vendors can fix this, and some already have:

Proposal for Prebid 12: no opt-in, core enforces it

In Prebid 12, requests from modules on the auction's critical path never carry Content-Type: application/json or non-CORS-safelisted headers. There is no opt-in.

Covered: bid adapters (their bid requests and every other call they make through src/ajax), user ID modules and RTD providers.

Not covered: analytics adapters, and anything else off the auction path. They may keep application/json and custom headers.

Core can tell which module is calling, because src/ajax.ts already gets the caller's [componentType, componentName] from the build-time caller context (plugins/callerContext.js, which the credentials activity check uses). For callers of type bidder, userId or rtd, core would:

  • send JSON and other string bodies as text/plain, and ignore contentType overrides. The other safelisted types, application/x-www-form-urlencoded and multipart/form-data, can stay;
  • drop non-safelisted entries from customHeaders. CORS-safelisted headers are kept: Accept, Accept-Language, Content-Language, and Content-Type with a safelisted value;
  • strip the same headers from the init.headers of fetch() from src/ajax (Semantiq's event collector uses this path);
  • log a logWarn naming the module and the dropped option, so it shows up in development.

The request options that exist today, and what happens to each:

option today Prebid 12, for bidder / userId / rtd callers
contentType (ajax options; bid adapters' request.options.contentType) any value dropped unless safelisted; body goes as text/plain
customHeaders any header non-safelisted names dropped
fetch(url, { headers }) any header non-safelisted names dropped
withCredentials, keepalive, method, endpointCompression unchanged unchanged (they don't trigger a preflight)
headers key in a bid adapter's request.options ignored already (adspirit, displayio set it) still ignored

Once core enforces this, these options are dead code in bid adapters, user ID and RTD modules. So the CodeQL rule prebid/json-request-content-type should report contentType with a non-safelisted value and any customHeaders/headers entry in those module types as errors, and stop at analytics adapters. Today it only checks *BidAdapter files, for the exact string 'application/json'.

Bodiless requests: fixed separately in 11.x

src/ajax.ts currently sets Content-Type on every request, including a GET with no body, so contentType: 'application/json' on a GET preflights for nothing. #16291 stops sending Content-Type on bodiless requests. It's a safe 11.x change on its own. Once it merges, Criteo ID, myGaru ID and Adtelligent ID stop preflighting with no change on their side. For locId this removes the content-type trigger only; x-api-key, when configured, remains.

Auth and protocol headers

  • UID2 / EUID: the only trigger is X-UID2-Client-Version on POST /v2/token/refresh, and it is a version tag, not a key. The UID2 token refresh docs say the request "needs no Authorization header (API key)" and that the body is the refresh token only. They don't list X-UID2-Client-Version at all. Client-side token generation (/v2/token/client-generate) already goes out as plain text/plain with no custom header. In the probe, the refresh endpoint answered (a) and (b) with the same 400 JSON for the fixture token, so it doesn't reject the request when the header is missing. Under the enforcement rule the header is simply dropped. If the operator wants the version, it can go in a query parameter (?client_version=). This doesn't need an exception. The operator team should confirm that, for both UID2 and EUID; @ashleysmithTTD, you're the most recent UID2 committer.
  • locId: sends x-api-key when apiKey is set, but the endpoint is a publisher-operated first-party proxy (per its docs). On the publisher's own origin, CORS doesn't apply at all. Cross-origin, the key would have to move to the URL. Since the key goes to the publisher's own proxy and not to a vendor, that is acceptable, and it's simpler than an exception. If an exception were ever kept for a protocol-mandated header, it would have to be documented as "do not put this module behind auctionDelay/waitForIt".
  • LiveIntent: the only custom header comes from live-connect. It is X-LI-Provided-User-Agent, set by asHeaders() only when a providedUserAgent is configured (a caller-supplied UA, e.g. in server-side or app integrations). It is sent on the GET identity-resolution call (libraries/liveIntentId/idSystem.js:39, through customHeaders). A default web setup sends no custom header. The probe sent the header-carrying variant to rp.liadm.com and got the same 200 JSON with and without it. @3link, could the UA go in the query string instead (live-connect already builds one in asQuery()), or does the header path only apply outside browsers?

Migration

  1. 11.x, voluntary: modules switch now. The probe results below tell each vendor whether their endpoint already accepts text/plain without custom headers. For the 31 in "works without", the switch is just deleting the option.
  2. 11.x, vendor servers: vendors whose endpoints need application/json (the 11 in "needs it") fix their servers before 12.0, as Insticator did in Insticator Bid Adapter: endpoint returns 400 since prebid/Prebid.js#15720 switched the request Content-Type to text/plain #15749.
  3. 12.0: core enforces it (above), and the CodeQL rule turns into an error for the covered module types.

Probe results

The probe is in https://github.com/prebid/prebidjs-releaser/pull/26 (preflight-probe/). Its README says how to re-run it against a Prebid.js checkout. The full results table is below. The probe builds each module's own request from its spec fixtures (670 specs). It then sends, from Node: (a) the request as the module sends it, (b) the same body as text/plain with no custom headers, and (c) an OPTIONS preflight from Origin: https://example.com. It found 82 modules with a trigger. The 15 of them already removed on prebid-12.0 are left out of the tables and lists below: 13 bidders, Experian RTD and Opera Ads ID. The current CodeQL rule misses 19 of the 68 bidders: the 11 adapters built on libraries/xeUtils, application/json;charset=... variants, custom headers, and the PBS adapter's publisher-configured headers. It never looks at the 14 user ID and RTD modules.

class bidder user ID RTD
works without 24 3 1
needs it 9 1 1
inconclusive 13 4 1
broken today 5 1 0

appnexus, mediafuse and winr are left out: they send X-Is-Test only with the apn_test debug flag, which isn't a production concern (core would drop it in 12.0 like any other custom header).

These come from one run, from one network, with test params. A DNS failure or timeout is a lead, not a verdict, and a 204 or no-bid to both requests only shows the content type is accepted.

Full results table (2026-11-20, master `28c664c19`)
class type module host method trigger (a) as sent (b) text/plain (c) preflight notes
broken today bidder asterioBidAdapter bid.asterio.ai POST header rtb-direct 415 no-bid 415 no-bid 200 the endpoint rejects the content type the module sends
broken today bidder epom_dspBidAdapter bidder.epommarket.com POST contentType application/json 400 no-bid 415 no-bid 500 preflight 500
broken today bidder rixengineBidAdapter demo.svr.rixengine.com POST contentType application/json 204 empty 204 empty 400 (b) is accepted: dropping the trigger would fix it; preflight 400
broken today bidder scatteredBidAdapter prebid.scattered.eu POST contentType application/json EAI_AGAIN EAI_AGAIN EAI_AGAIN (a) EAI_AGAIN
broken today bidder sonaradsBidAdapter prebidjs-bids-us1.sonar-ads.com POST contentType application/json timeout timeout timeout (a) timeout
broken today userId adtelligentIdSystem idrs.adtelligent.com GET contentType application/json (no body) timeout timeout timeout only a Content-Type on a request without a body: core stops sending it in #16291; (a) timeout
needs it bidder adrinoBidAdapter prd-prebid-bidder.adrino.io POST contentType application/json 204 empty 415 no-bid 200
needs it bidder axonixBidAdapter openrtb-us-east-1.axonix.com POST contentType application/json 200 no-bid 400 text: Schema violation: body must be obj 204
needs it bidder deepintentBidAdapter prebid.deepintent.com POST contentType application/json 200 empty 415 empty 200
needs it bidder idxBidAdapter dev-event.dxmdp.com POST contentType application/json 200 no-bid 415 no-bid 200
needs it bidder koblerBidAdapter bid.essrtb.com POST contentType application/json 204 empty 415 no-bid 200
needs it bidder oprxBidAdapter pb.optimizerx.com POST contentType application/json 200 bid 415 no-bid 200
needs it bidder performaxBidAdapter dale.performax.cz POST contentType application/json 200 no-bid 415 no-bid 200
needs it bidder proxistoreBidAdapter abs.proxistore.com POST header version; contentType application/json 204 empty 415 no-bid 200
needs it bidder voxBidAdapter ssp.hybrid.ai POST contentType application/json 204 empty 415 empty 204
needs it rtd semantiqRtdProvider api.adnz.co POST contentType application/json 204 empty 415 json 200 application/json is on the clickstream event collector, not the keywords request
needs it userId sevioIdSystem id.adx.ws POST contentType application/json 200 json 415 empty 200
inconclusive bidder asealBidAdapter tkprebid.aotter.net POST header x-aotter-clientid; header x-aotter-version; contentType application/json 401 no-bid 401 no-bid 200 auth header; both rejected the same way (test params?)
inconclusive bidder eskimiBidAdapter ittr-us-e.eskimi.com POST contentType application/json 400 empty 400 empty 200 both rejected the same way (test params?)
inconclusive bidder feedadBidAdapter api.feedad.com POST contentType application/json 400 text: 400 Bad Request 400 text: 400 Bad Request 200 both rejected the same way (test params?)
inconclusive bidder michaoBidAdapter rtb.michao-ssp.com POST contentType application/json 429 text: This website has been temporarily 429 text: This website has been temporarily 429 rate-limited or overloaded ((a) 429, (b) 429, preflight 429), not retried
inconclusive bidder mobkoiBidAdapter pbjs.mobkoi.com POST contentType application/json 403 no-bid 403 no-bid 204 both rejected the same way (test params?)
inconclusive bidder monetsiteBidAdapter rtb.monetize.site POST contentType application/json 400 empty 400 empty 200 both rejected the same way (test params?)
inconclusive bidder oguryBidAdapter mweb-hb.presage.io POST contentType application/json 400 empty 400 empty 200 both rejected the same way (test params?)
inconclusive bidder pstudioBidAdapter exchange.pstudio.tadex.id POST contentType application/json 400 empty 400 empty 200 both rejected the same way (test params?)
inconclusive bidder revcontentBidAdapter trends-s0.revcontent.com POST contentType application/json ENOTFOUND ENOTFOUND ENOTFOUND the spec fixture overrides the endpoint param; the default host is trends.revcontent.com
inconclusive bidder revealonBidAdapter pbjs.revealonmedia.live POST contentType application/json 400 text: 400 Bad Request 400 text: 400 Bad Request 204 both rejected the same way (test params?)
inconclusive bidder smartxBidAdapter bid.sxp.smartclip.net POST header x-openrtb-version; contentType application/json 400 empty 400 empty 204 both rejected the same way (test params?)
inconclusive bidder ssmasBidAdapter ads.ssmas.com POST contentType application/json 403 text: origin not allowed 403 text: origin not allowed 403 preflight 403; origin allowlist?
inconclusive bidder ventesBidAdapter ad.ventesavenues.in POST contentType application/json timeout 204 empty 204 (a) timeout, (b) 204
inconclusive rtd symitriDapRtdProvider prebid.dap.akadns.net POST contentType application/json ERR_TLS_CERT_ALTNAME_INVALID ERR_TLS_CERT_ALTNAME_INVALID ERR_TLS_CERT_ALTNAME_INVALID the host is publisher configuration (api_hostname); this one is the spec fixture's
inconclusive userId ceeIdSystem ceeid.eu POST contentType application/json 400 text: parsing consent string error: ille 400 text: parsing consent string error: ille 200 preflight allow-origin missing for https://example.com (no CORS, or an origin allowlist)
inconclusive userId euidIdSystem prod.euid.eu POST header x-uid2-client-version 400 json 400 json 204 both rejected the same way (test params?)
inconclusive userId lockrAIMIdSystem identity.loc.kr POST contentType application/json 500 json 200 json 204 (a) 500 but (b) 200: accepts text/plain
inconclusive userId uid2IdSystem prod.uidapi.com POST header x-uid2-client-version 400 json 400 json 204 both rejected the same way (test params?)
works without bidder ad2ictionBidAdapter ads.ad2iction.com POST contentType application/json 200 no-bid 200 no-bid 200
works without bidder adheseBidAdapter demo.ads.adhese.eu POST contentType application/json 200 no-bid 200 no-bid 200
works without bidder adipoloBidAdapter prebid.adipolo.live POST contentType application/json 200 no-bid 200 no-bid 204
works without bidder admaticBidAdapter layer.rtb.admatic.com.tr POST contentType application/json 204 empty 204 empty 204
works without bidder adtrgtmeBidAdapter rtb.cdn.adtarget.market POST contentType application/json 204 empty 204 empty 200
works without bidder advertisingBidAdapter prebid.technoratimedia.com POST contentType application/json 204 empty 204 empty 204
works without bidder afpBidAdapter ssp.afp.ai POST contentType application/json 204 empty 204 empty 204
works without bidder anzuDSPBidAdapter pbjs.anzu-rtb.live POST contentType application/json 200 no-bid 200 no-bid 204
works without bidder deltaprojectsBidAdapter d5p.de17a.com POST contentType application/json 204 empty 204 empty 200
works without bidder docereeAdManagerBidAdapter dai.doceree.com POST contentType application/json 200 bid 200 bid 200
works without bidder driftpixelBidAdapter pbjs.driftpixel.live POST contentType application/json 200 no-bid 200 no-bid 204
works without bidder finativeBidAdapter b.finative.cloud POST contentType application/json 204 empty 204 empty 204
works without bidder hybridBidAdapter hbe198.hybrid.ai POST contentType application/json 200 no-bid 200 no-bid 200
works without bidder impactifyBidAdapter logger.impactify.media POST contentType application/json 200 empty 200 empty 204 only outside the bid request (e.g. win/timeout notification)
works without bidder iqxBidAdapter pbjs.iqzonertb.live POST contentType application/json 200 no-bid 200 no-bid 204
works without bidder leagueMBidAdapter pbjs.league-m.media POST contentType application/json 200 no-bid 200 no-bid 204
works without bidder matterfullBidAdapter pbjs.bematterfull.com POST contentType application/json 200 no-bid 200 no-bid 204
works without bidder operaadsBidAdapter s.oa.opera.com POST header x-openrtb-version; contentType application/json 204 empty 204 empty 204
works without bidder pangleBidAdapter pangle.pangleglobal.com POST contentType application/json 204 empty 204 empty 200
works without bidder responsiveAdsBidAdapter ve60c4xzl9.execute-api.us-east-1.amazonaws.com POST contentType application/json 200 no-bid 200 no-bid 204
works without bidder robustAppsBidAdapter pbjs.rbstsystems.live POST contentType application/json 200 no-bid 200 no-bid 204
works without bidder unrulyBidAdapter targeting.unrulymedia.com POST contentType application/json 204 empty 204 empty 204
works without bidder welectBidAdapter www.welect.de POST contentType application/json 200 no-bid 200 no-bid 204
works without bidder xeBidAdapter pbjs.xe.works POST contentType application/json 200 no-bid 200 no-bid 204
works without rtd scope3RtdProvider prebid.scope3.com POST contentType application/json; header x-rtd-version 200 json 200 json 204
works without userId criteoIdSystem gum.criteo.com GET contentType application/json (no body) 200 json 200 json 200 only a Content-Type on a request without a body: core stops sending it in #16291
works without userId liveIntentIdSystem rp.liadm.com GET header x-li-provided-user-agent 200 json 200 json 204 X-LI-Provided-User-Agent is sent only when providedUserAgent is configured
works without userId mygaruIdSystem ident.mygaru.com GET contentType application/json (no body) 200 json 200 json 200 only a Content-Type on a request without a body: core stops sending it in #16291
out of scope bidder prebidServerBidAdapter prebid.adnxs.com POST header customheader1 404 text: 404 Not Found 404 Not Found nginx/ 404 text: 404 Not Found 404 Not Found nginx/ 405 headers come from the publisher's s2sConfig.customHeaders
Works without (28): can drop the trigger now

Bidders: ad2iction, adhese, adipolo, admatic, adtrgtme, advertising, afp, anzuDSP, deltaprojects, docereeAdManager, driftpixel, finative, hybrid, impactify (logger calls only; its bid request is already text/plain), iqx, leagueM, matterfull, operaads, pangle, responsiveAds, robustApps, unruly, welect, xe.

User ID: criteoId (fixed by #16291), liveIntentId (header only with providedUserAgent), mygaruId (fixed by #16291).

RTD: scope3 (application/json and x-rtd-version).

Checklist: vendor confirmation or server fix

The handles come from recent commits and PR authors for each module. Please correct me if someone else owns a module now.

Needs it: (b) rejected with 415/400, so the server needs a fix

Broken today: the request as sent can't work in a browser (input for the 12.0 dead-adapter audit)

Inconclusive: please confirm whether your endpoint accepts text/plain without custom headers

User ID modules not reached by the probe, or with requested reviewers

🤖 Generated with Claude Code

Activity

  1. patmmccann commented on Nov 20, 2026

    @patmmccann
    CollaboratorAuthor

    🤖 This comment was written by an AI agent (Claude Code) on behalf of @patmmccann.

    PRs opened for the works-without group (endpoints that returned the same response to application/json and text/plain in the probe):

    Each one removes contentType: 'application/json' from the bid request options, so core sends the same body as text/plain and the browser skips the preflight. Each PR tags the adapter's maintainers and asks them to confirm.

  2. patmmccann commented on Nov 20, 2026

    @patmmccann
    CollaboratorAuthor

    🤖 This comment was written by an AI agent (Claude Code) on behalf of @patmmccann.

    Follow-up: I re-probed the 21 bidders with open application/json removal PRs (#16294 to #16307) using the documented test params from each modules/<adapter>BidAdapter.md, instead of the spec fixtures. The probe's new --md-params mode (prebid/prebidjs-releaser#26) builds the bids through each adapter's own buildRequests for a placeholder page, and sends each endpoint one application/json and one text/plain request.

    • Real bid both ways: 1. responsiveAds (ResponsiveAds Bid Adapter: send bid requests as text/plain to avoid a CORS preflight #16307), with price and currency present in both responses.
    • No bid both ways: 17. The 8 xeUtils adapters (xeUtils: send bid requests as text/plain to avoid a CORS preflight #16294), ad2iction, adhese, afp, adtrgtme, deltaprojects, finative, pangle, unruly and welect. docereeAdManager is also in this group, but on its spec fixture: its buildRequests sends nothing for the .md params without publisher user config. The content type was accepted either way, but these still need a real placement to show a bid.
    • Same error both ways: 2.
      • admatic: the .md's host (layer.serve.admatic.com.tr) doesn't resolve. The fixture host answered 204 both ways before.
      • advertising: 458 "Domain not whitelisted" for the placeholder page, with either content type.
    • Different results between the two content types: none.

    Each PR now has its own result in a comment.

  3. schubert-sc commented on Nov 21, 2026

    @schubert-sc
    Contributor

    smartx belongs under "needs it", not "inconclusive". The 400 to both requests came from the spec fixture's params. With a real staging placement, bid.sxp.smartclip.net only bids with application/json plus x-openrtb-version:

    Content-Type x-openrtb-version result
    application/json 2.5 200, bid
    application/json none 400
    text/plain 2.5 400
    text/plain none 400

    So the endpoint needs a fix before 12.0. It has to accept the body as text/plain and get the version from the query string. I've passed that on to the team that runs it. The adapter change is ready and goes up once the endpoint side is settled.

  4. charlie0228 commented on Nov 24, 2026

    @charlie0228
    Contributor

    ad2iction (#16295) is listed under "works without", but the evidence doesn't support that yet. Both content types return 200 no-bid, which only shows the type is accepted, not that the body is parsed. @dgirardi-bot's probe on #16295 shows application/json returns Set-Cookie: ad2udid=<udid from body> and 400 on malformed JSON, while text/plain returns neither.

    Could ad2iction be moved to "inconclusive" until we've checked the endpoint? We'll update once we've confirmed the behavior and, if needed, fixed it.

  5. alexandr-kim-vl commented on Nov 25, 2026

    @alexandr-kim-vl
    Contributor

    Semantiq RTD: the clickstream collector (api.adnz.co) now accepts text/plain, and #16331 drops the application/json header from the beacon.

  6. acsbendi commented on Nov 25, 2026

    @acsbendi
    Contributor

    Kobler: thanks for the heads-up! Our endpoint (bid.essrtb.com) should be fixed now, text/plain works just the same as application/json

  7. patmmccann commented on Nov 25, 2026

    @patmmccann
    CollaboratorAuthor

    🤖 This comment was written by an AI agent (Claude Code) on behalf of @patmmccann.

    Kobler moves from needs it to fixed: thanks @acsbendi. A re-probe today got the same response both ways from bid.essrtb.com (204 / 204, preflight 200; it was 415 for text/plain in the first run), and the dev endpoint returned a priced bid both ways for the documented test page. #16337 drops contentType: 'application/json' from koblerBidAdapter.

  8. charlie0228 commented on Nov 26, 2026

    @charlie0228
    Contributor

    Follow-up on ad2iction: the endpoint fix is deployed. A valid body sent as text/plain is now parsed the same as application/json (the udid is echoed back in Set-Cookie, and malformed JSON returns 400 for both), and a live placement returns a real bid with either content type. ad2iction can go back under "works without". Since #16295 was closed, I've opened #16344 with the same change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions