Sovrn's Ad Exchange supports GZIP compression for HTTP request and response bodies. To use it, you'll compress your request payload, set the appropriate HTTP headers, and send the compressed bytes to Sovrn's endpoint.
Prerequisites
-
An active Sovrn Ad Exchange integration
-
Access to your integration's HTTP client or request-handling code
-
A GZIP library for your language (most have one built in)
Step 1: Compress the request body
Take the JSON payload you'd normally send and compress it using the GZIP algorithm. Most languages include built-in support:
Python
import gzip, json
payload = json.dumps(your_bid_request).encode("utf-8")
compressed = gzip.compress(payload)
Node.js
const zlib = require("zlib");
const payload = Buffer.from(JSON.stringify(yourBidRequest));
zlib.gzip(payload, (err, compressed) => { /* send compressed */ });
Java
ByteArrayOutputStream bos = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(bos);
gzip.write(jsonBytes);
gzip.close();
byte[] compressed = bos.toByteArray();
Step 2: Set the required HTTP headers
Every GZIP-compressed request must include these headers:
Content-Encoding: gzip
Content-Type: application/json
Content-Encoding: gzip tells Sovrn's server the body is compressed. Content-Type: application/json indicates the format of the decompressed body.
Step 3: Request a compressed response (optional)
To receive a GZIP-compressed response from Sovrn, add:
Accept-Encoding: gzip
Most HTTP clients decompress the response automatically. Check your client's documentation if you need to configure this explicitly.
Step 4: Send the compressed payload
Send the compressed bytes as the request body — don't apply any additional encoding like Base64 on top of the GZIP output unless your HTTP client specifically requires it.
Step 5: Verify your implementation
Before going live, confirm the following:
-
Your outbound requests include
Content-Encoding: gzip -
The payload is being sent in compressed form (not plain JSON)
-
Sovrn accepts the request and returns a valid response
-
If using
Accept-Encoding: gzip, the response arrives compressed and your client decodes it correctly
A tool like Wireshark or a proxy like Charles can help you inspect request and response headers during testing.
Questions? Concerns? Our team would be more than happy to help. Reach out to our Support Team here.