HTTP 1.1 规定:“客户端必须在所有 HTTP/1.1 请求消息中包含 Host 标头字段”
但是,我正在使用的机器发送这个精确的 POST(包含坐标),我无权更改:
POST /touch HTTP/1.1
Content-type: application/x-www-form-urlencoded
Content-Length: <n>
x=<int x>&y=<int y>
由于缺少 Host 标头字段, Tomcat 7 立即响应400 Bad Request
,并且 POST 永远不会到达我的 servlet。有什么办法可以避免此错误响应并使用 servlet 处理 POST 以支持这些旧机器?