Skip to content

Ad2iction Bid Adapter: send bid requests as text/plain to avoid a CORS preflight - #16295

Closed
patmmccann wants to merge 1 commit into
prebid:masterfrom
patmmccann:agent-ad2iction-no-json-ctype
Closed

patmmccann wants to merge 1 commit into
prebid:masterfrom
patmmccann:agent-ad2iction-no-json-ctype

Conversation

@patmmccann

Copy link
Copy Markdown
Collaborator

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

Type of change

  • Other: performance (removes a CORS preflight)

Description of change

modules/ad2ictionBidAdapter.js set options.contentType: 'application/json' on its bid request, which made the browser send a CORS preflight before every bid request. A preflight costs about as much network time as the bid request itself (see #12948).

This drops the option, so core sends the same JSON body as text/plain, like most bid adapters. withCredentials: false is kept. The body is an object, which core JSON.stringifys regardless of the content type, so the payload is unchanged.

The preflight probe in #16293 sent the endpoint the same body both ways and got the same response:

adapter endpoint application/json text/plain
ad2iction ads.ad2iction.com 200 no-bid 200 no-bid

Related: #16293 (Prebid 12 proposal), #12948. Model PR: #16294.

@charlie0228 (maintainer email: prebid@ad2iction.com), please confirm your server accepts text/plain.

Tests

The spec now asserts the bid request has no contentType and still sends withCredentials: false. ad2ictionBidAdapter_spec.js passes; lint is clean.

🤖 Generated with Claude Code

…S preflight

Removes contentType: 'application/json' from the bid request options, so
core sends the same JSON body as text/plain and the browser skips the CORS
preflight. See prebid#16293 and prebid#12948.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T20:51:51.898839Z 0197f1b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@patmmccann

Copy link
Copy Markdown
Collaborator Author

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

Re-probed with the preflight probe's new --md-params mode (prebid/prebidjs-releaser#26): the bids are built by the adapter's own buildRequests from the documented test params, for a placeholder page (https://publisher.example/news/article.html), and sent once each way from Node.

With the test params from ad2ictionBidAdapter.md, application/json → 200, no bid, text/plain → 200, no bid.

The endpoint accepted text/plain exactly like application/json, but the test placement didn't bid either way, so this doesn't show a real bid coming back. Please confirm with a real placement.

@dgirardi-bot

Copy link
Copy Markdown

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

This looks broken: the endpoint seems to ignore the body when it's sent as text/plain. Suggest holding the merge until the vendor confirms the server parses it regardless of Content-Type.

We POSTed an adapter-shaped body to https://ads.ad2iction.com/html/prebid/ from Origin: https://example.com:

body application/json text/plain;charset=UTF-8
valid, udid: "probe-udid-123" 200 [], Set-Cookie: ad2udid=probe-udid-123 (value read from the body), X-Adtype: html 200 [], no Set-Cookie, no X-Adtype
{not json 400 200 []

The text/plain response to a valid body has the same shape as the JSON response to an empty {}. Garbage gets 400 as JSON but 200 as text/plain, and the udid isn't echoed. Both suggest the server only decodes the body when it's sent as application/json. CORS itself passes (Access-Control-Allow-Origin: *), so real placements would silently get no bids. We couldn't test a live placement (the .md id accepted-uuid never bids).

@charlie0228

Copy link
Copy Markdown
Contributor

Thanks for the PR and for the probe work. I'm the maintainer of ad2iction (prebid@ad2iction.com).

Please hold this PR for now. We haven't yet confirmed that our endpoint parses the request body when it is sent as text/plain, and the evidence so far suggests it may not.

The probe results (no-bid with both content types) don't show that the body is read. The comment from @dgirardi-bot above points the same way: with a valid body containing udid, application/json returns Set-Cookie: ad2udid=... while text/plain does not, and a malformed body returns 400 only as application/json.

Our adapter keeps udid in the body and sends withCredentials: false, so if the body isn't parsed, requests would lose user identification and return no bids without any error.

We'll check the server side and report back here. If the endpoint needs a change, we'll make it and verify with a real placement before this PR is merged.

@charlie0228

Copy link
Copy Markdown
Contributor

Following up on my earlier comment: @dgirardi-bot's probe was right, and our endpoint only parsed the body when the Content-Type was exactly application/json. We've fixed it on the server side:

  • The JSON body is now parsed for both text/plain and application/json. MIME parameters such as ;charset=UTF-8 are ignored, and the type is matched case-insensitively.
  • Malformed JSON returns 400 for both content types.
  • application/json keeps working, so older adapter versions are unaffected.

Verified against production after the deploy:

body application/json text/plain;charset=UTF-8
valid, udid: "probe-udid-123" 200, Set-Cookie: ad2udid=probe-udid-123 200, Set-Cookie: ad2udid=probe-udid-123
{not json 400 400
live placement real bid real bid (same price and currency)

Since this PR was closed, I've opened #16344 with the same change. Thanks @patmmccann and @dgirardi-bot for the probing.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants