I have looked at the traffic between Apache and Uwsgi using the http_proxy 
module, and between my client and Apache when using the uwsgi_proxy module (no 
way to snoop the network!), and I think the uwsgi_proxy module is at fault.

I looked at the traffic between apache (http_proxy) and uwsgi over an 
http-socket, and I saw the chunking occurring. For very small requests (<10kb) 
apache makes a content-length header. That was confusing me for a few days! I 
ended up using a ~400k file and that shows the chunking behavior. 

I also looked at the traffic between apache and my client when using 
uwsgi_proxy, and although apache log says it sends a 411, I actually don't see 
any data in the actual TCP stream coming back from the server. The server 
simply ends the connection with a FIN (not RST). I will send the raw trace if 
you want to see that. The important thing is that I see the chunked-content 
request, it appears properly formatted, and uwsgi doesn't seem to see the 
request. That points me to the module in apache, rather than uwsgi itself.

So, I think that the uwsgi_proxy module needs to be looked at next. I'm happy 
to look at it. This isn't urgent, as http_proxy works well enough for me right 
now.

Let me know if you'd like me to look at the module, or if you'd prefer 
something else.

Steve

My test environment: 

Uwsgi invokation:
/usr/sbin/uwsgi --socket 127.0.0.1:2101 --http-socket 127.0.0.1:2001 -A 10 
--wsgi-file /usr/local/vf/objsrv/bin/objsrv.wsgi --processes 10 
--snmp=127.0.0.1:3001 --snmp-community public --daemonize2 
/var/log/uwsgi-objsrv --log-syslog=objsrv --pidfile /var/run/objsrv.pid 
--http-manage-expect --http-raw-body --chunked-input-limit 1052672

--- Good request using http_proxy module ---
Apache config:
SetEnv proxy-sendchunked 1
ProxyPass /objsrv/1.0/ http://127.0.0.1:2001/

TCP dump on loopback, port 2001:
PUT /e3/52283d99e92e505a.oid/5c/523236b7eb8320ea.data HTTP/1.1
Host: 127.0.0.1:2001
User-Agent: libwww-perl/5.837
X-Forwarded-For: XXXX
X-Forwarded-Host: XXXX
X-Forwarded-Server: XXXX
Connection: Keep-Alive
Transfer-Encoding: chunked

4000
...

Apache log:
192.168.128.146 - - [12/Sep/2013:14:48:40 -0700] "PUT 
/objsrv/1.0/e3/52283d99e92e505a.oid/5c/523236b7eb8320ea.data HTTP/1.1" 201 - 
"-" "libwww-perl/5.837"

Uwsgi log:
[pid: 1661|app: 0|req: 1/11] 127.0.0.1 () {32 vars in 546 bytes} [Thu Sep 12 
14:48:40 2013] PUT /e3/52283d99e92e505a.oid/5c/523236b7eb8320ea.data => 
generated 0 bytes in 553 msecs (HTTP/1.1 201) 2 headers in 83 bytes (0 switches 
on core 0)


--- Bad request using uwsgi_proxy module ---
Apache config:
SetEnv proxy-sendchunked 1
ProxyPass /objsrv/1.0 uwsgi://127.0.0.1:2101/

TCP dump on public network, port 80:
PUT /objsrv/1.0/e3/52283d99e92e505a.oid/54/5232372f2a7ace7f.data HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Host: 192.168.128.147
User-Agent: libwww-perl/5.837
Transfer-Encoding: chunked

10000
...

Apache log:
192.168.128.146 - - [12/Sep/2013:14:50:39 -0700] "PUT 
/objsrv/1.0/e3/52283d99e92e505a.oid/54/5232372f2a7ace7f.data HTTP/1.1" 411 319 
"-" "libwww-perl/5.837"

Nothing in uwsgi log.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Roberto De Ioris
Sent: Saturday, September 07, 2013 11:49 PM
To: uWSGI developers and users list
Subject: Re: [uWSGI] mod_uwsgi with chunked request body causes 411

Are you sure mod_proxy_http does not work without it in chunked mode ?

--
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to