Reputation: 85
I want to ignore requests with big cookie size. We have some requests dropped in varnish due to "BogoHeader Header too long: Cookie: xyz". How can it be done in VCL? I didn't find any len, length or strlen function in VCL, I know that it can be done in the vcl_rcev phase.
Upvotes: 1
Views: 1122
Reputation: 1087
The strlen()
feature won't help to fix your problem. Varnish discards the request due to the large Cookie
header before vcl_recv
is executed. If you don't want those requests to be discarded you need to check and adjust some runtime parameters: http_req_hdr_len
, http_req_size
, http_resp_hdr_len
, etc.
In any case, if you are still interested in the strlen()
feature, it would be trivial to add it to the std
VMOD, but that support doesn't exist at the moment. You could consider using an existing VMOD including utilities like strlen()
(or implement it on your own), but that's probably too much work. Finally, you could consider using a hacky approach using just VCL and a regexp:
if (req.http.Cookie ~ "^.{1024,}$") {
...
}
Upvotes: 2