GZIP in Ad Exchange
Overview
Sovrn’s CTV and Mobile App integrations support the use of GZIP compression for HTTP request and response bodies. GZIP is a widely used, lossless compression format that reduces payload size and improves data transfer efficiency, especially in environments with bandwidth constraints. For these reasons, Sovrn recommends utilizing GZIP with your CTV and Mobile App integration.
What is GZIP?
GZIP is a compression algorithm and file format used to reduce the size of data transmissions. In HTTP contexts, GZIP is applied to the request or response body.
When a body is GZIP-encoded:
The sender compresses the body using the gzip algorithm.
The sender sets the appropriate HTTP headers to indicate compression.
The receiver automatically decompresses the body before processing.
Using GZIP results in:
Reduced bandwidth usage
Faster transfer times
Improved performance on mobile and CTV devices
Implementing GZIP for Sovrn Integrations
To send a GZIP-compressed request body to Sovrn, publishers should follow the guidelines below:
1. Compress the Request Body
The JSON or other structured payload that would normally be sent should be compressed using the GZIP algorithm. Most languages provide built-in support for this.
Examples:
Python
Use the gzip module: gzip.compress(json_bytes)
Node.js
Use the zlib module: zlib.gzip()
Java
Wrap the output stream with GZIPOutputStream.
2. Set Required HTTP Headers
When sending a compressed request body, the following HTTP headers must be included:
Content-Encoding: gzip
Content-Type: application/json
These indicate that:
The request body is encoded using GZIP.
The body format is still JSON after decompression.
To request a GZIP-compressed response from Sovrn (optional), include:
Accept-Encoding: gzip
This instructs Sovrn’s server to return the response using GZIP compression if supported.
3. Send the Compressed Payload
After compression, the request body should contain the compressed bytes rather than the original JSON string.
Ensure no additional encoding (such as Base64) is applied unless specifically required by your HTTP client.
4. Verification and Testing
Publishers should verify that:
The outbound request contains the correct Content-Encoding header.
The payload is being sent in compressed form.
Sovrn accepts and responds correctly to compressed requests.
Optional: the response is compressed when
Accept-Encoding: gzipis included.
Many HTTP clients automatically handle compressed responses but may require explicit configuration to GZIP request bodies.
Summary
GZIP support in Sovrn’s CTV and Mobile App integrations allows publishers to reduce bandwidth, improve performance, and optimise data transfer efficiency.
By compressing request bodies and using the proper HTTP headers, publishers can ensure compatibility with Sovrn’s systems while achieving more efficient network communication.
Questions? Concerns?
Our team would be more than happy to help. Reach out to our Support Team here.