Squid - 400 on POST request

岁酱吖の 提交于 2019-12-12 03:54:35

问题


The following HTTP request returns a 400 ERR_INVALID_REQ -

POST http://distservp1.pb.com/dstproduct.asp HTTP/1.1 
Proxy-Authorization: Basic Og==
Host: distservp1.pb.com
Connection: close
Content-type: application/x-www-form-urlencoded
Content-length: 638

PBXML=%3CSignonReq%3E%0D%0A%0...

The response (body contains no additional information)-

HTTP/1.0 400 Bad Request
Server: squid/2.7.STABLE8
Date: Wed, 04 Jan 2017 09:07:16 GMT
Content-Type: text/html
Content-Length: 2054
X-Squid-Error: ERR_INVALID_REQ 0
X-Cache: MISS from [ProxyName].local
X-Cache-Lookup: NONE from [ProxyName].local:8080
Via: 1.0 [ProxyName].local:8080 (squid/2.7.STABLE8)
Connection: close

Looking at a packet capture the body of the POST request is sent in two PDUs. The 400 is sent back before the second PDU is sent - so I would imagine the error lies int he headers. The Squid cache.log just shows -

clientTryParseRequest: FD 20 (192.168.120.72:49503) Invalid Request

A similar request generated from the DHC plugin in chrome succeeds -

POST http://distservp1.pb.com/dstproduct.asp HTTP/1.1
Host: distservp1.pb.com
Proxy-Connection: keep-alive
Content-Length: 638
Origin: chrome-extension://aejoelaoggembcahagimdiliamlcdmfm
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8

Can anyone see what is going wrong here? And any ideas on how to fix it? We are not able to modify the application which is sending the request. It works fine on a device not routed through the proxy.


回答1:


Turns out the application in question is adding a space character at the end of the request line. This causes Squid to reject it.



来源:https://stackoverflow.com/questions/41461877/squid-400-on-post-request

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!