Skip to content

incompatible gzip request compression support between Prebid.js and prebid-server #4474

@postindustria-code

Description

@postindustria-code

Background

Prebid.js prebidServerAdapter suggests to use endpointCompression param on the s2sConfig that enables the following behavior:

  • Content-Type is text/plain, but body is gzip-compressed
  • gzip=1 URL param is added
  • Content-Encoding is not set to avoid pre-flight request by the browser

Prebid Server has this code:

reqContentEncoding := httputil.ContentEncoding(httpRequest.Header.Get("Content-Encoding"))
if reqContentEncoding != "" {
if !deps.cfg.Compression.Request.IsSupported(reqContentEncoding) {
errs = []error{fmt.Errorf("Content-Encoding of type %s is not supported", reqContentEncoding)}
return
} else {
r, err = getCompressionEnabledReader(httpRequest.Body, reqContentEncoding)
if err != nil {
errs = []error{err}
return
}
}
}

that expects Content-Encoding: gzip header on the request. Thus Prebid.js and Prebid Server do not meet in their expectations.

Proposed fix

Change the Prebid Server check to rather watch for gzip=1 param on the request and if set then attempt to decompress the request body. Or to watch for either of Content-Encoding: gzip header (since it is already implemented and somebody may be using it??) or gzip=1 URL param - and then decompress.

Prebid Server Java

It looks like PBS-Java has the same compatibility issue as it is built on Spring Boot with Netty, which typically relies on the Content-Encoding header to detect and decompress gzipped request bodies.

Related

prebid/Prebid.js#12973 here gzip=1 was implemented
#2438 - apparently the Content-Encoding support appeared earlier in PBS than gzip=1 appeared in PB.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Community Review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions