Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chunked Transfer Encoding doesn't work with Apache and mod_proxy_uwsgi #1540

Open
mtreinish opened this issue May 25, 2017 · 1 comment
Open

Comments

@mtreinish
Copy link

mtreinish commented May 25, 2017

When configuring apache to use mod_proxy_uwsgi and incoming requests have a body with a chunked transfer encoding apache returns:

HTTPException: 411 Length Required: Length Required: A request of the requested method PUT requires a valid Content-length.: Apache/2.4.18 (Ubuntu) Server at 158.69.92.142 Port 80 (HTTP N/A)

Running uwsgi in http mode and using mod_proxy to forward the http worked fine.

For reference the uwsgi ini file is:

[uwsgi]
http-auto-chunked = true
http-chunked-input = true
http-raw-body = true
chmod-socket = 666
lazy-apps = true
add-header = Connection: close
buffer-size = 65535
thunder-lock = true
plugins = python
enable-threads = true
exit-on-reload = true
die-on-term = true
master = true
processes = 2
socket = /var/run/uwsgi/glance-wsgi-api.socket
wsgi-file = /usr/local/bin/glance-wsgi-api

And the apache site conf was:

ProxyPass "/image" "unix:/var/run/uwsgi/glance-wsgi-api.socket|uwsgi://uwsgi-uds-glance-wsgi-api/" retry=0

This was happening when running uwsgi 2.0.15

openstack-gerrit pushed a commit to openstack/devstack that referenced this issue Oct 19, 2017
Calling setenv appears to be globally scoped which is breaking the
glance path which relies on chunked uploads. The glance path is
separated by using mod_proxy instead of mod_proxy_uwsgi because
mod_proxy_uwsgi doesn't support chunked encoding.[1] The proxy-sendcl [2]
was set on the mod_proxy_uwsgi path just in case someone tried to send a
chunked request to the api server we would be able to handle it. It
tells apache to locally cache the chunked request and send the
content-length as a normal upload to the upstream server. However, if we
can only set it globally across then small potential benefit is not worth
having all glance uploads cached by apache. This commit just removes
setting the flag. In the future if we can have devstack isolate this
flag it might be worth adding back to the mod_proxy_uwsgi path, but for
right now it's not worth the tradeoff.

[1] unbit/uwsgi#1540
[2] https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#request-bodies

Depends-On: Idf6b4b891ba31cccbeb53d373b40fce5380cea64
Change-Id: Iab2e2848877fa1497008d18c05b0154892941589
Closes-Bug: #1709970
@joshuahlang
Copy link

I believe this is due to this line. Specifically the REQUEST_CHUNKED_ERROR option which causes the 411 error. Perhaps using the REQUEST_CHUNKED_DECHUNK would work, though I haven't tried it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants