Hi Ricky,
Probably found the anomaly in the filename header : vs = the header
should probably be "filename: a.pdf" instead of "filename= a.pdf"
[2.4.4-DEVELOPMENT][root@pfSe.localdomain]/root: echo "show errors" |
socat stdio /var/lib/haproxy/stats | head -n 30
Total events captured on [02/Apr/2018:14:42:10.603] : 2
[02/Apr/2018:14:40:57.817] backend app (#3): invalid response
frontend main (#2), server app1 (#1), event #1
src 192.168.0.40:49068, session #9, session flags 0x000004ce
HTTP msg state MSG_HDR_NAME(17), msg flags 0x00000000, tx flags
0x28603000
HTTP chunk len 0 bytes, HTTP body len 0 bytes
buffer flags 0x80008002, out 0 bytes, total 15360 bytes
pending 15360 bytes, wrapping at 16384, error at position 155:
00000 HTTP/1.1 200 OK\r\n
00017 Server: nginx\r\n
00032 Date: Mon, 02 Apr 2018 12:40:57 GMT\r\n
00069 Content-Type: application/pdf\r\n
00100 Transfer-Encoding: chunked\r\n
00128 Connection: close\r\n
00147 filename=a.pdf: \r\n
00165 Strict-Transport-Security: max-age=31536000\r\n
00210 X-Content-Type-Options: nosniff\r\n
00243 \r\n
00245 1fb8\r\n
00251 %PDF-1.5\r\n
Op 2-4-2018 om 5:22 schreef Xu Ricky:
Thank you for your reply, sorry ,I am not english.Probably not very
accurate.
http://exemple.com/pdf.php
·error 502I've been trying this for weeks.
1.But you can directly access nginx.
2.Haproxy+apache+php is ok.
3.http://exemple.com/a.pdf <http://exemple.com/a.pdf>is ok.
4.Haproxy tcp proxy is ok.
5.
/[root@t08 haproxy-1.8.5]# haproxy -f /etc/haproxy/haproxy.cfg -d///
/Available polling systems :/
/ epoll : pref=300, test result OK/
/ poll : pref=200, test result OK/
/ select : pref=150, test result FAILED/
/Total: 3 (2 usable), will use epoll./
//
/Available filters :/
/ [SPOE] spoe/
/ [COMP] compression/
/ [TRACE] trace/
/Using epoll() as the polling mechanism./
/00000000:main.accept(0005)=0009 from [192.168.241.40:2787] ALPN=<none>/
/00000001:main.accept(0005)=000a from [192.168.241.40:2788] ALPN=<none>/
/00000000:main.clireq[0009:ffffffff]: GET ///pdf.phpHTTP/1.1/
/00000000:main.clihdr[0009:ffffffff]: Host: 192.168.241.18/
/00000000:main.clihdr[0009:ffffffff]: Connection: keep-alive/
/00000000:main.clihdr[0009:ffffffff]: Cache-Control: max-age=0/
/00000000:main.clihdr[0009:ffffffff]: Upgrade-Insecure-Requests: 1/
/00000000:main.clihdr[0009:ffffffff]: User-Agent: Mozilla/5.0 (Windows
NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/64.0.3282.140 Safari/537.36/
/00000000:main.clihdr[0009:ffffffff]: Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8/
/00000000:main.clihdr[0009:ffffffff]: Accept-Encoding: gzip, deflate/
/00000000:main.clihdr[0009:ffffffff]: Accept-Language: zh-CN,zh;q=0.9/
/00000000:app.srvcls[0009:adfd]/
/00000000:app.clicls[0009:adfd]/
/00000000:app.closed[0009:adfd]/
/00000001:main.clicls[000a:ffffffff]/
/00000001:main.closed[000a:ffffffff]/
*发件人:*PiBa-NL [mailto:piba.nl....@gmail.com]
*发送时间:*2018年3月31日1:20
*收件人:*Xu Ricky <xu.binf...@live.com>; haproxy@formilux.org
*主题:*Re: proxy error 502
Hi Ricky,
Works for me with your configuration, mostly.
Adding a bind to the frontend and using haproxy 1.8.3 (it doesn't
allow the implicit bind on the frontend line itself..).
Also added the fastcgi config and a empty mimetype file..
[2.4.3-RELEASE][root@pfSe.localdomain
<mailto:root@pfSe.localdomain>]/root: haproxy -f
/root/XuRicky/haproxy.cfg -d
Available polling systems :
kqueue : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result FAILED
Total: 3 (2 usable), will use kqueue.
Available filters :
[TRACE] trace
[COMP] compression
[SPOE] spoe
Using kqueue() as the polling mechanism.
00000000:main.accept(0005)=0009 from [192.168.0.40:56777] ALPN=<none>
00000001:main.accept(0005)=000a from [192.168.0.40:56778] ALPN=<none>
00000002:main.accept(0005)=000b from [192.168.0.40:56779] ALPN=<none>
00000000:main.clireq[0009:ffffffff]: GET /a.pdf HTTP/1.1
00000000:main.clihdr[0009:ffffffff]: Host: 192.168.0.133
00000000:main.clihdr[0009:ffffffff]: Connection: keep-alive
00000000:main.clihdr[0009:ffffffff]: Upgrade-Insecure-Requests: 1
00000000:main.clihdr[0009:ffffffff]: User-Agent: Mozilla/5.0 (Windows
NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like G ecko)
Chrome/65.0.3325.181 Safari/537.36
00000000:main.clihdr[0009:ffffffff]: Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*
;q=0.8
00000000:main.clihdr[0009:ffffffff]: Accept-Encoding: gzip, deflate
00000000:main.clihdr[0009:ffffffff]: Accept-Language:
nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7
00000000:app.srvrep[0009:000c]: HTTP/1.1 200 OK
00000000:app.srvhdr[0009:000c]: Server: nginx/1.12.2
00000000:app.srvhdr[0009:000c]: Date: Fri, 30 Mar 2018 12:52:26 GMT
00000000:app.srvhdr[0009:000c]: Content-Type: application/octet-stream
00000000:app.srvhdr[0009:000c]: Content-Length: 1625682
00000000:app.srvhdr[0009:000c]: Last-Modified: Thu, 29 Mar 2018
23:20:07 GMT
00000000:app.srvhdr[0009:000c]: Connection: close
00000000:app.srvhdr[0009:000c]: ETag: "5abd74a7-18ce52"
00000000:app.srvhdr[0009:000c]: Accept-Ranges: bytes
00000000:app.srvcls[0009:adfd]
00000001:main.clicls[000a:ffffffff]
00000001:main.closed[000a:ffffffff]
00000002:main.clicls[000b:ffffffff]
00000002:main.closed[000b:ffffffff]
00000003:main.clicls[0009:ffffffff]
00000003:main.closed[0009:ffffffff]
Regards,
PiBa-NL (Pieter)
Op 30-3-2018 om 4:47 schreef Xu Ricky:
Hi:
File.zip (nginx haproxy php)
·I can't solve it ,please help me!thank you!
#error
502 Bad Gateway The server returned an invalid or incomplete response.
https://static.oschina.net/uploads/space/2018/0326/214155_DKqA_1441082.png