Nginx reports when used with varnish

Hello all,

My setting works well through nginx->apache but not through
nginx->varnish->apache

apache is configured to listen to port 8080 . when nginx uses

proxy_pass http://127.0.0.1:8080

the sites are running fine.

If I introduce varnish after nginx by [proxy_pass
http://127.0.0.1:6082]
the nginx starts throwing following error and browser also shows "Zero
Sized Reply"

[error] 17147#0: *207 upstream sent no valid HTTP/1.0 header while
reading
response header from upstream

and /var/log/messages shows

varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Wr 101
Unknown
request.#012Type ‘help’ for more info.#012all commands are in
lower-case.

varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Rd
Cache-Control: max-age=0

obviously varnish is configured to listen to apache

backend default {
.host = “127.0.0.1”;
.port = “8080”;
}

Can anyone please suggest the possible reason which is causing the
problem ?

varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Wr 101
Unknown request.#012Type ‘help’ for more info.#012all commands are in
lower-case.

varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Rd
Cache-Control: max-age=0

Can you capture the tcp 6082 traffic and post the entire HTTP
conversation?

Lukas

Hello Lukas,

I have just checked and found nothing

tcpdump -vv port 6082

tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size
65535
bytes

Hello Lukas,

I have just checked and found nothing

tcpdump -vv port 6082

tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size
65535 bytes

Fix your capture.

  • capture the traffic on loopback, not eth0
  • don’t truncate packets (-s 0)
  • write in a cap file, tcpdump output is not very helpful

$ tcpdump -i lo -s0 -w tcp6082-traffic.cap port 6082

Lukas

Thanks Lukas,

here are the O/P

324241^B^@^D^@^@^@^@^@^@^@^@^@377377^@^@^A^@^@^@N/VS}D^K^@B^@^@^@B^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@4212277@
^@@^F262^B^?^@^@^A^?^@^@^A
244377^W302^\241262N^@^@^@^@200252376(^@^@^B^D377327^A^A^D^B^A^C^C^GN/VS221D^K^@B^@^@^@B^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@4^@^@@^@@^F<302^?^@^@^A^?^@^@^A^W377:200/R^\241262O200R252252376(^@^@^B^D377327^A^A^D^B^A^C^C^GN/VS240D^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212300@
^@@^F262^M^?^@^@^A^?^@^@^A244377^W302^\241262O:200/SP^P^AV376^^@^@N/VS317D^K^@230^C^@^@230^C^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^C
212212301@^@@^F256250^?^@^@^A^?^@^@^A244377^W302^\241262O:200/SP^X^AV^A^?^@^@GET
/ HTTP/1.0
Host: dustri.bookopt.de
X-Real-IP: 198.168.1.4
X-Forwarded-For: 198.168.1.4
X-Server-Address: 198.168.1.2
Connection: closeUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X
10.9;
rv:27.0) Gecko/20100101 Firefox/27.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: PHPSESSID=itbms92ndcea9o8f4tcbfpsm2r2na3o0ioebelh9b0fucs06mpr1;
fe_typo_user=a9682cd3423a1e558c956ab49641251b; currency=USD;
location=OT;
__utma=49103283.176983647.1397562265.1397562265.1397562265.1;
__utmc=49103283;
__utmz=49103283.1397562265.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
be_typo_user=a49b1cc985e75a936d94171a8ace0a4b; mypanel=up;
typo3-login-cookiecheck=true;
phpMyAdmin=itbms92ndcea9o8f4tcbfpsm2r2na3o0ioebelh9b0fucs06mpr1
Cache-Control: max-age=0

N/VS337D^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(^W242@
^@@^F%,^?^@^@^A^?^@^@^A^W377:200/S^\241265261P^P^Ac376^^@^@N/VS0E^K^@^P^A^@^@^P^A^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^A^B^W243@^@@^F$O^?^@^@^A^?^@^@^A^W377:200/S^\241265261P^X^Ac376366^@^@200
204
-----------------------------Varnish Cache CLI 1.0

Linux,3.11.10-7-default,x86_64,-sfile,-smalloc,-hcritbit

Type ‘help’ for command list.
Type ‘quit’ to close CLI session.
N/VSYE^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212302@
^@@^F262^K^?^@^@^A^?^@^@^A244377^W302^\241265261:2000-P^P^A^376^^@^@N/VS275E^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W244@^@@^F$316^?^@^@^A^?^@^@^A^W377:2000-^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type ‘help’ for more info.
all commands are in lower-case.
N/VS315E^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212303@
^@@^F262^?^@^@^A^?^@^@^A244377^W302^\241265261:2000207P^P^A^376^^@^@N/VF^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W245@^@@^F$315^?^@^@^A^?^@^@^A^W377:2000207^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type ‘help’ for more info.
all commands are in lower-case.

N/VS^TF^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212304@^@@^F262

^?^@^@^A^?^@^@^A244377^W302^\241265261:2000341P^P^A^376^^@^@N/VS9F^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W246@^@@^F$314^?^@^@^A^?^@^@^A^W377:2000341^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type ‘help’ for more info.
all commands are in lower-case.

N/VSFF^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212305@
^@@^F262^H^?^@^@^A^?^@^@^A244377^W302^\241265261:2001;P^P^A^376^^@^@N/VSrF
^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W247@^@@^F$313^?^@^@^A^?^@^@^A^W377:2001;^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type ‘help’ for more info.
all commands are in lower-case.

N/VS~F^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212306@
^@@^F262^G^?^@^@^A^?^@^@^A244377^W302^\241265261:2001225P^P^A^376^^@^@N/VS
242F^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W250@^@@^F$312^?^@^@^A^?^@^@^A^W377:2001225^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type ‘help’ for more info.
all commands are in lower-case.

N/VS262F^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212307@
^@@^F262^F^?^@^@^A^?^@^@^A244377^W302^\241265261:2001357P^P^A^376^^@^@N/VS355F^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W251@^@@^F$311^?^@^@^A^?^@^@^A^W377:2001357^\241265261P^X^Ac376v^@^@101
76 lines 18-49

N/VS#Y^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212314@
^@@^F262^A^?^@^@^A^?^@^@^A244377^W302^\241265261:2003261P^P^A^376^^@^@N/VS"]^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W256@^@@^F$304^?^@^@^A^?^@^@^A^W377:2003261^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type ‘help’ for more info.
all commands are in lower-case.

N/VSN]^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212315@
^@@^F262^@^?^@^@^A^?^@^@^A244377^W302^\241265261:2004^KP^P^A^376^^@^@N/VS
336a^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W257@^@@^F$303^?^@^@^A^?^@^@^A^W377:2004^K^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type ‘help’ for more info.
all commands are in lower-case.

N/VS^Fb^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212316@
^@@^F261377^?^@^@^A^?^@^@^A244377^W302^\241265261:2004eP^P^A^376^^@^@212/VS320U^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212317@
^@@^F261376^?^@^@^A^?^@^@^A244377^W302^\241265261:2004eP^Q^A^376^^@^@212/VS3V^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(^W260@
^@@^F%^^^?^@^@^A^?^@^@^A^W377:2004e^\241265262P^Q^Ac376^^@^@212/VSgV^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212320@
^@@^F261375^?^@^@^A^?^@^@^A244377^W302^\241265262:2004fP^P^A^376^^@^@
lines 57-84/84 (END)

Hello!

On Tue, Apr 22, 2014 at 12:55:07PM +0530, Joydeep Bakshi wrote:

varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Wr 101 Unknown
}

Can anyone please suggest the possible reason which is causing the problem ?

It looks like you’ve configured nginx to pass http to varnish CLI
port. For obvious reasons this isn’t going to work.


Maxim D.
http://nginx.org/

Thanks Lukas,

here are the O/P

Please post the capture file.

@Lukas - attached is the cap file

@Maxim - after starting varnish only the following port comes up

netstat -nat | grep 60

tcp 0 0 0.0.0.0:6082 0.0.0.0:*
LISTEN
tcp 0 0 :::6082 :::*
LISTEN

Hello!

On Tue, Apr 22, 2014 at 03:30:37PM +0530, Joydeep Bakshi wrote:

@Lukas - attached is the cap file

@Maxim - after starting varnish only the following port comes up

netstat -nat | grep 60

tcp 0 0 0.0.0.0:6082 0.0.0.0:* LISTEN
tcp 0 0 :::6082 :::* LISTEN

Check varnish starup options. As per documentation, the “-a”
argument of the varnishd is what you have to check:

https://www.varnish-cache.org/docs/4.0/reference/varnishd.html
https://www.varnish-cache.org/docs/4.0/tutorial/putting_varnish_on_port_80.html

Anyway, it doesn’t looks like something nginx-related.

My setting works well through nginx->apache but not through
the nginx starts throwing following error and browser also shows "*Zero
request.#012Type ‘help’ for more info.#012all commands are in lower-case.


nginx mailing list
[email protected]
nginx Info Page


nginx mailing list
[email protected]
nginx Info Page


Maxim D.
http://nginx.org/

@Lukas - attached is the cap file

The request is bogus, imho. A GET request should not contain a body, it
doesn’t
makes sense.

@Maxim - after starting varnish only the following port comes up

netstat -nat | grep 60

tcp 0 0 0.0.0.0:6082http://0.0.0.0:6082
0.0.0.0:* LISTEN
tcp 0 0 :::6082 :::* LISTEN

You are administrating and configuring this server, find out why and fix
it.

Lukas

Dear all,

Problem Solved.

Here is the steps required to fix it on opensuse 13.1

varnish listen to port 80 as default in opensuse and there is no port
6081
. Hence /etc/sysconfig/varnish has to be edited to add “-a :6081” like
below

VARNISHD_PARAMS="-f /etc/varnish/vcl.conf -a:6081 -T:6082 -s
file,/var/cache/varnish,1M -u varnish"

After restarting ; varnish provides 6081 port to be used with proxy_pass

Thanks for the responses