# Proxy\_pass of PUT with no Content\_length header returns 411

**URL:** <https://www.ruby-forum.com/t/proxy-pass-of-put-with-no-content-length-header-returns-411/227598>\
**Category:** NGINX\
**Created:** [March 20, 2013, 11:09pm UTC](https://www.ruby-forum.com/t/proxy-pass-of-put-with-no-content-length-header-returns-411/227598 "2013-03-20T23:09:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickpalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b77776/32.png) [@nickpalmer](https://www.ruby-forum.com/u/nickpalmer)\
**Post date:** [March 20, 2013, 11:09pm UTC](https://www.ruby-forum.com/t/proxy-pass-of-put-with-no-content-length-header-returns-411/227598/1 "2013-03-20T23:09:51Z")

</div>

I am having trouble with proxy\_pass and PUT without a Content-Length  
header  
returning a 411 error.

# curl -XPUT [http://localhost:8080/](http://localhost:8080/)
411 Length Required
# 411 Length Required

* * *
nginx/1.1.19 # touch temp # curl -X PUT http://localhost:8080/ -T temp {"response": "ok"} #

Relevant configuration:

# Proxy to Backend Server

server {  
listen localhost:8080;

location / {  
proxy\_set\_header Host $http\_host;  
proxy\_set\_header X-Forwarded-Host $http\_host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_pass http://backend\_server;  
}  
}

I found this post which seems to be the same problem:

> **[PUTs without "Content-Length" header line are rejected with a 411](https://forum.nginx.org/read.php?2,72279,72279#msg-72279)**
>
> Hey I am using nginx to proxy couchdb. Performing the following returns a 411 Length Required: curl -X PUT https://testing.com/abc --insecure --user john Whereas passing a length of 0 in works fine: curl -X PUT https://testing.com/abc --insec

Is there a way to get nginx to proxy PUT requests WITHOUT a  
Content-Length  
header?  
Does a newer version of nginx NOT suffer from this limitation?

Thanks,  
~ Nick

Posted at Nginx Forum:

> **[proxy\_pass of PUT with no Content\_length header returns 411](https://forum.nginx.org/read.php?2,237607,237607#msg-237607)**
>
> I am having trouble with proxy\_pass and PUT without a Content-Length header returning a 411 error. # curl -XPUT http://localhost:8080/ \<html\> \<head\>\<title\>411 Length Required\</title\>\</head\> \<body...

---

<div class="post-metadata">

**Author:** ![nickpalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b77776/32.png) [@nickpalmer](https://www.ruby-forum.com/u/nickpalmer)\
**Post date:** [March 21, 2013, 11:33am UTC](https://www.ruby-forum.com/t/proxy-pass-of-put-with-no-content-length-header-returns-411/227598/2 "2013-03-21T11:33:04Z")

</div>

Hello!

On Wed, Mar 20, 2013 at 06:09:26PM -0400, nickpalmer wrote:

> [http://forum.nginx.org/read.php?2,72279,72279#msg-72279](http://forum.nginx.org/read.php?2,72279,72279#msg-72279)
> 
> Is there a way to get nginx to proxy PUT requests WITHOUT a Content-Length  
> header?  
> Does a newer version of nginx NOT suffer from this limitation?

PUT requests without a Content-Length header (either using chunked  
transfer encoding, or without a request body at all) are allowed  
in nginx 1.3.9+.

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**
