[Varnish] #1318: weird POST behaviour in varnish

Varnish varnish-bugs at varnish-cache.org
Mon Jun 17 12:08:29 CEST 2013


#1318: weird POST behaviour in varnish
--------------------------+----------------------
 Reporter:  lorenzololli  |       Type:  defect
   Status:  new           |   Priority:  normal
Milestone:                |  Component:  varnishd
  Version:  3.0.3         |   Severity:  major
 Keywords:                |
--------------------------+----------------------
 Greetings,



 I'm experiencing a STRANGE behaviour from VARNISH during some POST.
 Basically, VARNISH make my BACKEND answer a generic error.

 I've this test configuration:



 backend default {
   .host = "10.20.30.40";
   .port = "80";
   .connect_timeout = 10s;
   .first_byte_timeout = 31s;
   .between_bytes_timeout = 31s;
 }
 import std;
 sub vcl_recv {
         if (req.url ~ "^/test/") {
                 std.log("---------------+++++++++++-----------!!!!!RECV
 ALWAYS PASS!!!!!---------+++++++++++----------------");
                 return (pass);
         }
 }
 The meaning is try to let all the content related to urls that start with
 /test/ to be passed, without caching. If I try to send a POST to /test/
 passing on varnish I get:


 $ curl --data "service=mail&email=testuser&password=testpassword"
 https://20.30.40.50/test/services.pl -k -v -H 'Host: www.somehost.it' -c
 cookie.txt -o /dev/null --user-agent "Mozilla/4.0 (compatible; MSIE 5.01;
 Windows NT 5.0)"
 * About to connect() to 20.30.40.50 port 443 (#0)
 *   Trying 20.30.40.50...
 * Adding handle: conn: 0x6631a0
 * Adding handle: send: 0
 * Adding handle: recv: 0
 * Curl_addHandleToPipeline: length: 1
 * - Conn 0 (0x6631a0) send_pipe: 1, recv_pipe: 0
   % Total    % Received % Xferd  Average Speed   Time    Time     Time
 Current
                                  Dload  Upload   Total   Spent    Left
 Speed
   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--
 0* Connected to 20.30.40.50 (20.30.40.50) port 443 (#0)
 [... SSL ... ]
 *        SSL certificate verify ok.
 > POST /test/services.pl HTTP/1.1
 > User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
 > Accept: */*
 > Host: www.somehost.it
 > Content-Length: 50
 > Content-Type: application/x-www-form-urlencoded
 >
 } [data not shown]
 * upload completely sent off: 50 out of 50 bytes
 < HTTP/1.1 500 Internal Server Error
 * Server Apache/2.2.15 (CentOS) is not blacklisted
 < Server: Apache/2.2.15 (CentOS)
 < Content-Type: text/html; charset=iso-8859-1
 < Content-Length: 616
 < Accept-Ranges: bytes
 < Date: Mon, 17 Jun 2013 09:34:54 GMT
 < X-Varnish: 1530875689
 < Age: 0
 < Via: 1.1 varnish
 < Connection: keep-alive
 <
 { [data not shown]
 100   666  100   616  100    50   1001     81 --:--:-- --:--:-- --:--:--
 1003
 * Connection #0 to host 20.30.40.50 left intact
 This request, end with a 500 generic error, wich I can found both in
 varnishlog and on apachelog:


 1.2.3.4 - - [17/Jun/2013:11:34:53 +0200] "POST /test/services.pl HTTP/1.1"
 500 616 "-" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
 If I change the configuration to not match POST on this URL everithing is
 working correctly



 backend default {
   .host = "10.20.30.40";
   .port = "80";
   .connect_timeout = 10s;
   .first_byte_timeout = 31s;
   .between_bytes_timeout = 31s;
 }
 import std;
 sub vcl_recv {
         if ((req.url ~ "^/test/") && (req.request != "POST")) {
                 std.log("---------------+++++++++++-----------!!!!!RECV
 ALWAYS PASS!!!!!---------+++++++++++----------------");
                 return (pass);
         }

         if (req.request != "POST") {
                 return (pass);
         }
 }

 $ curl --data "service=mail&email=testuser&password=testpassword"
 https://20.30.40.50/test/services.pl -k -v -H 'Host: www.somehost.it' -c
 cookie.txt -o /dev/null --user-agent "Mozilla/4.0 (compatible; MSIE 5.01;
 Windows NT 5.0)"
 * About to connect() to 20.30.40.50 port 443 (#0)

 *   Trying 20.30.40.50...

 * Adding handle: conn: 0x6631a0

 * Adding handle: send: 0

 * Adding handle: recv: 0

 * Curl_addHandleToPipeline: length: 1

 * - Conn 0 (0x6631a0) send_pipe: 1, recv_pipe: 0

   % Total    % Received % Xferd  Average Speed   Time    Time     Time
 Current

                                  Dload  Upload   Total   Spent    Left
 Speed

   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--
 0* Connected to 20.30.40.50 (20.30.40.50) port 443 (#0)

 [... SSL ... ]
 > POST /test/services.pl HTTP/1.1

 > User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

 > Accept: */*

 > Host: www.somehost.it

 > Content-Length: 50

 > Content-Type: application/x-www-form-urlencoded

 >

 } [data not shown]

 * upload completely sent off: 50 out of 50 bytes

 < HTTP/1.1 302 Found

 * Server Apache/2.2.15 (CentOS) is not blacklisted

 < Server: Apache/2.2.15 (CentOS)

 * Added cookie mail="someusercookieok" for domain somehost.it, path /,
 expire 0

 < Set-Cookie: mail=someusercookieok; path=/; domain=.somehost.it

 < Location:
 https://mailserver.somehost.it/?username=testuser@somehost.it&password=somepassword&SessionIDMethod=yes

 < Content-Type: text/html; charset=iso-8859-1

 < Content-Length: 392

 < Accept-Ranges: bytes

 < Date: Mon, 17 Jun 2013 09:48:39 GMT

 < X-Varnish: 1724297640

 < Age: 0

 < Via: 1.1 varnish

 < Connection: keep-alive

 <

 { [data not shown]

 100   442  100   392  100    50    444     56 --:--:-- --:--:-- --:--:--
 444

 * Connection #0 to host 20.30.40.50 left intact

 This is happening always. 302 answer is fine, services.pl does
 authenticate then redirect to my email server.


 I'm using a centos 6.4 with Kernel version:
 varnish1 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012
 x86_64 x86_64 x86_64 GNU/Linux


 Varnish version

 # varnishd -V
 varnishd (varnish-3.0.3 revision 9e6a70f)

 Copyright (c) 2006 Verdens Gang AS

 Copyright (c) 2006-2011 Varnish Software AS

 Is it a bug?

 Best regards,

 Lorenzo

 P.s. I've posted it on forumm as well: https://www.varnish-
 cache.org/forum/topic/1034

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1318>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list