Varnish vs. X-JSON header

Florian Engelhardt f.engelhardt at 21torr.com
Thu Mar 27 15:55:09 CET 2008


Hello,

i've got a problem with the X-JSON HTTP-Header not beeing delivered by
varnish in pipe and pass mode.
My application runs on PHP with lighttpd, when querying the lighty
direct (via port :81), the header is present in the request. PHP Script
is as follows:

<?php
header('X-JSON: foobar');
echo 'foobar';
?>

Requesting with curl shows the following:

$ curl http://server.net/test.php -D -
HTTP/1.1 200 OK
Expires: Fri, 28 Mar 2008 14:49:29 GMT
Cache-Control: max-age=86400
Content-type: text/html
Server: lighttpd
Content-Length: 6
Date: Thu, 27 Mar 2008 14:49:29 GMT
Age: 0
Via: 1.1 varnish
Connection: keep-alive

foobar


Requesting on port 81 (where lighty listens on):

$ curl http://server.net:81/test.php-D -
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Expires: Fri, 28 Mar 2008 14:51:45 GMT
Cache-Control: max-age=86400
X-JSON: foobar
Content-type: text/html
Date: Thu, 27 Mar 2008 14:51:45 GMT
Server: lighttpd

foobar


Why is this X-JSON header missing when requested via varnish?

Kind Regards

Flo

PS: my vcl file:

backend default {
  .host = "127.0.0.1";
  .port = "81";
}

sub vcl_recv {
  if (req.url ~ "^/media\.php.*" || req.url == "/status/") {
    pass;
  }
  if (req.url ~ "^/ADMIN.*") {
    pipe;
  }
  if (req.url == "/test.php") {
    pass;
  }
}

# test.php entry just for testing purpose



More information about the varnish-misc mailing list