prebid / prebid-cache

Apache License 2.0
31 stars 60 forks source link

400 bad request, request header or cookie too large #56

Closed kizzard closed 4 years ago

kizzard commented 4 years ago

Type of issue

bug

Description

I have observed the Prebid Cache endpoint (https://prebid.adnxs.com/pbc/v1/cache) returning error status 400 and a message along the lines of "bad request, request header or cookie too large". This was in turn causing the pbjs exception: "Failed to save to the video cache", and no video bids were being considered.

Please note this is distinct from the "Post cache element n exceeded max size" error. It seems to be coming from the HTTP server itself ie. NGINX.

I checked the HTTP requests and observed at least 2 very large (multi-kilobyte) cookies set in the header. The error subsided after clearing adnxs.com cookies. It occurred to me that there could be circumstances that large cookies are being set on this domain which is then causing errors with the cache endpoint. However I did not save the cookies prior to troubleshooting so I cannot verify precisely which cookies were causing the issue.

I thought it might be worth doing a sanity check to ensure that no API endpoints on prebid.adnxs.com are setting abnormally large cookies which could be then causing failed requests on the cache endpoint. I don't know exactly what other codebases utilize this domain, so not sure exactly how to check myself.

Also it might be worth checking the NGINX logs to discover how many 400 errors are being emitted with this particular reason.

Steps to reproduce

While I cannot reproduce the origin of the large cookies, the problem was replicated while load a page containing Prebid with configured video ad units such as https://www.si.com/nfl/2020/01/13/nfl-playoffs-divisional-round-49ers-titans-chiefs-packers-head-coaching-carousel-mmqb?pbjs_debug=true

Expected results

Prebid cache requests should return 200 status codes.

Actual results

Prebid cache returned 400 status codes due to abnormally large cookies on the http request.

Platform details

Prebid 2.44.1 Windows

SyntaxNode commented 4 years ago

Are you still experiencing this issue?

This issue is AppNexusXandr specific and has since been corrected. There is no explicit cookie size limit in the Prebid Cache app itself.