Strange problem with truncated responses when POSTing data

Eli Dickinson eli at
Fri Oct 1 00:09:06 CEST 2010


First, thanks for Varnish! It's a great piece of software.

Today, though, I've been pulling my hair out with a strange problem
and I'm hoping someone here can help. I've got Varnish sitting in
front of Apache on one server and I've got a PHP script that POSTs
data from another server. If the length of the content I'm posting is
over about 1500 bytes, I get an incomplete response from Varnish.
Like, literally I only get half the page back. According to Wireshark,
it looks like I get 1 or 2 packets of data (it's not consistent) and
then there's suddently a RST/ACK.

Weirder still, an almost identical request from cURL works fine. So
it's either some kind of funny timing issue or it's something very
specific to the way PHP makes HTTP requests.

The problem disappears if:
- I tell varnish to pipe instead of pass
- I run the PHP script on the same server and have it POST to
localhost (which makes me think timing is a factor...)
- I POST less than 1kb of data

I'm running varnish-2.1.3 SVN and I don't see anything unusual in the
syslog or when running varnishlog (though I'm not exactly sure what
I'm looking for)

Here's what my request looks like:

Content-Length: 1517


And the response I get back looks like:

HTTP/1.1 403 Forbidden
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.14
Expires: Sun, 11 Mar 1984 12:00:00 GMT
Last-Modified: Thu, 30 Sep 2010 21:40:44 +0000
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
ETag: "1285882844"
Content-Type: text/html; charset=utf-8
Content-Length: 4104
Date: Thu, 30 Sep 2010 21:40:44 GMT
X-Varnish: 598880740
Age: 0
Via: 1.1 varnish
Connection: close

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

The response looks fine (content-length is correct), aside from the
fact that I don't get all of it.

I'm stumped. Any thoughts?

Eli Dickinson
FierceMarkets, Inc.

More information about the varnish-misc mailing list