不带内容长度标头的PUT的nginx proxy_pass返回411
我在使用nginx proxy_pass和PUT时遇到问题,没有返回411错误的内容长度头 我运行什么来测试这个:不带内容长度标头的PUT的nginx proxy_pass返回411,nginx,reverse-proxy,http-status-code-411,Nginx,Reverse Proxy,Http Status Code 411,我在使用nginx proxy_pass和PUT时遇到问题,没有返回411错误的内容长度头 我运行什么来测试这个: # curl -XPUT http://localhost:8080/ <html> <head><title>411 Length Required</title></head> <body bgcolor="white"> <center><h1>411 Length Require
# curl -XPUT http://localhost:8080/
<html>
<head><title>411 Length Required</title></head>
<body bgcolor="white">
<center><h1>411 Length Required</h1></center>
<hr><center>nginx/1.1.19</center>
</body>
</html>
# touch temp
# curl -X PUT http://localhost:8080/ -T temp
{"response": "ok"}
我发现这个帖子似乎也有同样的问题:
有没有办法让nginx在没有内容长度头的情况下代理PUT请求
较新版本的nginx是否不存在此缺陷/限制?升级到
nginx>=1.4.1
(1.3.9
或1.4.0
就足够了,但存在安全问题thx@elhefe-请参阅注释)或按上述方式安装。对于Debian和RedHat家族来说,这是一个很好的选择
Debian:
- 气喘后遗症(目前为1.4.4-1)
添加到
/etc/apt/sources。列表
:
deb http://ftp.debian.org/debian/ wheezy-backports main
运行并安装您选择的nginx版本(deb http://nginx.org/packages/debian/ wheezy nginx deb-src http://nginx.org/packages/debian/ wheezy nginx
,nginx full
,nginx light
)nginx naxsi
- nginx.org包(稳定版本目前为1.4.4):
添加到
/etc/apt/sources。列表
:
deb http://ftp.debian.org/debian/ wheezy-backports main
删除当前的nginx包:deb http://nginx.org/packages/debian/ wheezy nginx deb-src http://nginx.org/packages/debian/ wheezy nginx
更新包列表:apt-get remove nginx-full nginx-common
对于类似Debian的行为更改更新apt-get update apt-get install nginx
/etc/nginx/nginx.conf
并在user www-data;
部分末尾添加http
include /etc/nginx/sites-enabled/*;
include /etc/nginx/sites-enabled/*;