[squid-users] Empty transfer-encoding header causes 502 response

Alex Rousskov rousskov at measurement-factory.com
Tue Oct 25 13:07:56 UTC 2022


On 10/23/22 20:36, Matthew H wrote:
> Hi,
> 
> I'm using Squid to proxy HTTP requests to another proxy. I can see squid 
> sending the request to the parent and getting a response, but it sends 
> the client that initiated the request a 502 Bad Gateway response.
> 
> On closer inspection it appears the parent proxy is sending an 
> empty transfer-encoding header, and this is causing Squid to send a 502. 

Do you know whether the response body was using chunked (or any other 
non-identity) encoding? I have already added your case to the list of 
known rejected responses[1], but it would be good to update that with 
the information on the actual response encoding.

[1] https://github.com/squid-cache/squid/pull/702#issuecomment-762459132

If the very first bytes of the response are "<html" or similar, then no 
encoding was probably applied. If you see what can be interpreted as a 
small hex number followed by a new line, then chunked encoding was 
probably applied (at least). If you cannot tell, or are not sure, feel 
free to share the response packet in libpcap format, captured with 
wireshark or "tcpdump -s0".


Thank you,

Alex.



> 2022/10/24 00:23:59.106| ctx: enter level  0: 'http://nintendo.com/ 
> <http://nintendo.com/>'
> 2022/10/24 00:23:59.106| 11,3| http.cc(666) processReplyHeader: 
> processReplyHeader: key '19010000000000000C00000000000000'
> 2022/10/24 00:23:59.106| 11,2| http.cc(720) processReplyHeader: HTTP 
> Server conn294 local=172.25.0.3:57802 
> <http://172.25.0.3:57802/> remote=159.203.14.9:1996 
> <http://159.203.14.9:1996/> FIRSTUP_PARENT FD 26 flags=1
> 2022/10/24 00:23:59.106| 11,2| http.cc(721) processReplyHeader: HTTP 
> Server RESPONSE:
> ---------
> HTTP/1.1 200 OK
> x-powered-by: Express
> content-type: text/html; charset=iso-8859-1
> transfer-encoding:
> date: Mon, 24 Oct 2022 00:23:57 GMT
> connection: close
> 
> ----------
> 2022/10/24 00:23:59.106| 55,3| HttpHeader.cc(882) getList: empty list 
> header: Transfer-Encoding(Transfer-Encoding[63])
> 2022/10/24 00:23:59.106| 55,2| HttpHeader.cc(559) parse: WARNING: 
> unsupported Transfer-Encoding used by client:
> 2022/10/24 00:23:59.106| ctx: exit level  0
> 2022/10/24 00:23:59.106| 20,3| store.cc(1673) reset: 
> http://nintendo.com/ <http://nintendo.com/>
> 2022/10/24 00:23:59.107| 17,3| FwdState.cc(492) fail: ERR_INVALID_RESP 
> "Bad Gateway"
> http://nintendo.com/ <http://nintendo.com/>
> 2022/10/24 00:23:59.107| 17,3| FwdState.cc(533) unregister: 
> http://nintendo.com/ <http://nintendo.com/>
> 
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users



More information about the squid-users mailing list