> I'm debugging the issue with Gitlab when cloning over http, and it seems
> the issue is chunked responses from rack apps when run behind nginx.
>
>
> I've created this simple Rack app, that responds with chunked http
> transfer encoding
> https://gist.github.com/gdamjan/8737900
>
> First of all, is that script correct?
>
>
> I tested it with just uwsgi --http-socket, uwsgi --http-socket behind
> nginx with proxy_pass, and uwsgi --socket behind nginx with uwsgi_pass
>
> Accessing the uwsgi http socket directly, I get the http chunks the way
> the rack app sent it.
>
> When the same uwsgi is behind nginx as a http proxy and with
> proxy_buffering off, I still get a chunked response and the final output
> is correct, though it's strange that the chunks are not the same as what
> the rack app sent. nginx decided to combine several chunks into one.
> which is still ok I guess.
>
> But when using uwsgi_pass, uwsgi_buffering off (or on), the output - the
> content - that I get is:
> ...
> 4
> abcd
> 4
> abcd
> ...
>
>
> and the actual chunks are something like
> ....
> 12
> 4
> abcd
> 4
> abcd
>
> 1b
> 4
> abcd
> 4
> abcd
> 4
> abcd
> ....
>
> I've tried this with both 1.4.4, 1.5.8 and 1.2.2 all behaved the same -
> is it a bug in the uwsgi module in nginx? Should this even work?
>
> --
> damjan
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>

I digged a bit in nginx mailing-list and it looks like it is the expected
behaviour for RFC 3875

Basically CGI based protocols (FastCGI, SCGI, uwsgi) should not make
assumptions about the frontend proxy support. In addition to this chunked
encoding MUST not be returned by apps if the protocol is 1.0 (this is not
the case of nginx, but could be the case for dozens of other proxies).

I think the "right thing to do" is making the chunked response usage in
gitlab more smart (disable it for 1.0, disable if a proxy-related header
is in place and so on), but this will not solve the issue as the Rack
layer does not know if the underlaying environment is HTTP, proxied-HTTP,
CGI or anything else.

Honestly, as uwsgi is CGI based for request but fully HTTP based for
responses, i see nothing wrong in nginx supporting chunked encoding.

You can try asking in the nginx mailing-list while i check if it is a
simple thing to add.

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

Reply via email to