如何忽略清漆中的大饼干 [英] How to ignore big cookies in varnish

查看:18
本文介绍了如何忽略清漆中的大饼干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想忽略具有大 cookie 大小的请求.由于BogoHeader Header 太长:Cookie:xyz",我们在清漆中丢弃了一些请求.如何在 VCL 中完成?我在VCL中没有找到任何len、length或strlen函数,我知道它可以在vcl_rcev阶段完成.

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.

推荐答案

strlen() 功能无助于解决您的问题.由于 Cookie 头很大 before vcl_recv 被执行,Varnish 会丢弃请求.如果不希望这些请求被丢弃,则需要检查和调整一些运行时参数:http_req_hdr_lenhttp_req_sizehttp_resp_hdr_len 等.

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.

无论如何,如果您仍然对 strlen() 功能感兴趣,将其添加到 std VMOD 中将是微不足道的,但该支持不会目前不存在.您可以考虑使用现有的 VMOD,包括诸如 strlen() 之类的实用程序(或自行实现),但这可能工作量太大.最后,您可以考虑使用仅使用 VCL 和正则表达式的 hacky 方法:

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,}$") {
    ...
}

这篇关于如何忽略清漆中的大饼干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆