varnish / varnish-modules

Collection of Varnish Cache modules (vmods) by Varnish Software
Other
182 stars 86 forks source link

bodyaccess #109

Closed opensubtitles closed 6 years ago

opensubtitles commented 6 years ago

Hi,

varnishd (varnish-5.2.1 revision NOGIT)

   if (req.method == "POST" && req.http.host ~ "^api.opensubtitles.org") {
        std.cache_req_body(1KB);
        if (bodyaccess.rematch_req_body("DisabledUA") == 1) {
                return (synth(429, "Too Many Requests"));
        }
   }

if POST is more than 1KB, then Varnish close connection without any http return code/response. Not sure if this is desired behavior, for me it seems like bug.

214.125.201.209 - - [27/Mar/2018:12:08:54 +0200] "POST http://api.opensubtitles.org:80/xml-rpc HTTP/1.0" - 0 "-" "xmlrpc-epi-php/0.2 (PHP)"
dridi commented 6 years ago

It sounds like you should open an issue in varnish-cache instead, unless it's only happening when using vmod-bodyaccess?

opensubtitles commented 6 years ago

I am not sure, if it happens on "std.cache_req_body(1KB);" or "if (bodyaccess.rematch_req_body("DisabledUA") == 1) {" - it might, because probably it is empty...

dridi commented 6 years ago

Can you confirm the connection closure if you comment out vmod-bodyaccess usage?

opensubtitles commented 6 years ago

I can confirm problem is with "std.cache_req_body(1KB);", I will open ticket in varnish-cache