Varnish showing hex characters from Jakarta-Tomcat connector protocol

David Brown captkiddo at gmail.com
Tue Jun 29 18:31:53 CEST 2010


I checked and it seems the Transfer-Encoding header is being stripped by
Varnish. I can see it when I go directly to the web server but not when I
view the file through Varnish.


I worked around the problem by adding this to my VCL


In sub vcl_fetch


 # Is Transfer-Encoding in the response, if so store it.

if (beresp.http.Transfer-Encoding ~ "chunked") {

set beresp.http.X-Encoding = beresp.http.Transfer-Encoding;

}




In sub vcl_deliver


 # Putting back the Transfer-Encoding header

if (resp.http.X-Encoding == "chunked") {

set resp.http.Transfer-Encoding = "chunked";

}



It is odd that Varnish only seems to strip the header when the content come
from Tomcat through the JK connector. The same files delivered from the same
web server, but as flat files, don't have the same thing happen.


Perhaps Tomcat or the JK connector is doing some odd formating.



Thanks for your help.




On Mon, Jun 28, 2010 at 3:14 PM, Poul-Henning Kamp <phk at phk.freebsd.dk>wrote:

> In message <AANLkTinQeX14NVc6TkE1tUNOCabdPcSYEtq160Iqi6gq at mail.gmail.com>,
> Davi
> d Brown writes:
>
> >When we put Varnish 2.1.2 in place of Squid we see hex characters showing
> up
> >in content from Tomcat, typically "1ff8".
>
> This is what is called "HTTP/1.1 chunked encoding" headers.
>
> Somehow one end does not realize that chunked encoding is being used.
>
> Check Transfer-Encoding headers and HTTP version fields are not
> disturbed.
>
>
>
> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20100629/7701665d/attachment-0003.html>


More information about the varnish-dev mailing list