Swift and Nginx as loadbalancer

Bug #903646 reported by Dmitry Ukov
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Invalid
Undecided
Unassigned

Bug Description

I'm experiencing Content-Length parameter issue when using nginx as a loadbalancer for Swift.

I've configured Swift with two proxies and nginx as loadbalancer.

nginx config :

upstream backend_storage {
  server swift-proxy1:8888 weight=3;
  server swift-proxy2:8888;
}

server {
  client_max_body_size 5000m;
  listen 8888;
  location / {
    proxy_pass http://backend_storage;
    proxy_read_timeout 120;
  }
}

proxy-server.conf

[filter:tempauth]
use = egg:swift#tempauth
user_system_root = testpass .admin http://loadbalancer:8888/v1/AUTH_system

Then I tried use Swift CLI client and got:
# swift -A http://locadbalancer:8888/v1.0 -U system:root -K testpass post testcontainer
Container PUT failed: http://loadbalancer:8888/v1/AUTH_system/testcontainer 411 Length Required

Nginx requires:
when someone do a PUT request, there should be Content-Length field in http header.
Then I've added in put_container function for swift CLI client
headers['Content-Length'] = 0

Now everything works fine.

Could you comment this error?

P.S. Actually HTTP protocol RFC does not requires Content-Length parameter in PUT request.

Dmitry Ukov (dukov)
description: updated
Revision history for this message
Juan J. Martínez (jjmartinez) wrote :

It looks like nginx is picky with PUT/POST requests without Content-Length header.

Reference: http://www.ruby-forum.com/topic/162976#715758

Using 0 as Content-Length doesn't look right, and you may have the same problem with any other client not setting Content-Length properly.

I gave up using nginx as swift load balancer. I'd recommend you using Pound instead: http://www.apsis.ch/pound

Revision history for this message
Dmitry Ukov (dukov) wrote :

Ok, I understand. Thanks a lot.

Changed in swift:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.