Server-to-Server (s2s) Calls

BidSwitch calls the Buyer endpoint using a s2s call in the following cases:

  • The initial call from the Supplier/Publisher side was done using a s2s call

  • BidSwitch is calling the Buyer burl

  • BidSwitch is calling the Buyer nurl as the BidSwitch Bid Request had the imp.ext.s2s_nurl field set to 1.

An easy way to determine whether the call from BidSwitch is s2s is to check the user agent. For s2s calls it is always "BidSwitch/1.0". One advantage of s2s impression calls is increased control of the call delivery, and thus minimizing any discrepancies between partners’ reporting and/or invoicing.

Expected s2s Behaviour

  • BidSwitch expects HTTP 200, 204, or 302 responses to s2s calls, if you have recorded a valid impression.

  • If BidSwitch receives a response code > 399, i.e. HTTP 4xx, or 5xx, it denotes the impression as not properly recorded on the Buyer side, and will lead to discrepancies between BidSwitch and the Buyer.

  • If the response code is >= 400, or there was a timeout, BidSwitch makes 1 retry to check if a valid impression was recorded on the Buyer side.

  • BidSwitch will bill based on its numbers, regardless of Buyer response. See the Discrepancy API for Buyer section for details about managing discrepancies.

s2s Headers

When sending s2s impression calls, BidSwitch uses the following headers.

  • User-Agent: Indicates that the impression call is relayed by BidSwitch, this is always BidSwitch/1.0.

  • X-User-Agent: Specifies the application type, operating system, software vendor or software version of the original request.

  • X-Forwarded-For: Identifies the originating IP address.

  • X-BSW-ServerUpstream: A value of 1 indicates that the original impression call to BidSwitch was from a server.

# Example of s2s headers from burl imp request
X-Forwarded-For: 77.16.215.3, 18.196.6.164
X-BSW-ServerUpstream: 1
User-Agent: BidSwitch/1.0
X-User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Mobile/15C153 [FBAN/FBIOS;FBAV/179.0.0.50.82;FBBV/116150041;FBDV/iPhone8,1;FBMD/iPhone;FBSN/iOS;FBSV/11.2.1;FBSS/2;FBCR/Telenor;FBID/phone;FBLC/nb_NO;FBOP/5;FBRV/0]

Use the following table to compare the s2s vs u2s headers BidSwitch applies in each circumstance.

BidSwitch s2s and u2s HTTP Headers

SSP to DSP

s2s:s2s_nurl in request or adslot

s2s:burl in response

u2s

s2s

User-Agent: BidSwitch/1.0
X-BSW-ServerUpstream: 1
User-Agent: BidSwitch/1.0
X-BSW-ServerUpstream: 1
X-User-Agent: (applied from user in most cases)
X-Forwarded-For:

n/a; s2s forwarded as s2s only

u2s

User-Agent: BidSwitch/1.0
X-Forwarded-For:
X-User-Agent: (applied from user)
User-Agent: BidSwitch/1.0
X-Forwarded-For:
X-User-Agent: (applied from user)
X-Forwarded-For:
X-User-Agent: See u2s note

Note

u2s: In all other scenarios which the table outlines, BidSwitch applies its own headers. Except in the u2s case, where it forwards the initial u2s call without any alteration.