Proxy pass, upstream and http/1.0
cliff at develix.com
Thu Jul 30 12:44:20 MSD 2009
On Thu, 2009-07-30 at 02:57 -0400, komone wrote:
> Cliff Wells Wrote:
> > On Wed, 2009-07-29 at 17:50 -0400, komone wrote:
> > > It is correct that Nginx can/will only establish
> > a 1.0 connection to
> > > an upstream application server?
> > Yes.
> > > I can't see a way to make the proxy-pass honor
> > 1.1 protocol.
> > Is there a reason you need HTTP/1.1 to the
> > backend? Most web apps
> > should work with either.
> Web app servers are generally connection oriented and HTTP/1.1
> provides far better connection support. When a new connection is made
> the app server has session setup as well as connection setup on a per
> connection basis, so constraint to HTTP/1.0 is very restricting.
> Beyond that there are many other parts of HTTP/1.1 that enrich the
> protocol. Olivier mentioned just one with chunked encoding, but
> consider other types of transfer such as ranged requests, Further
> reasons include but are not limited to: Extensibility Caching
> Bandwidth optimization Network connection management Message
> transmission Internet address conservation Error notification
> Security, integrity, and authentication and Content negotiation
Many, if not most, people using Nginx are proxying to application
servers (myself included). Without knowing a lot about your particular
application, I'm still inclined to venture that you are likely seriously
over-concerned about the direness of this situation.
With a notable exception, most of the additional benefits of HTTP/1.1
you list (copied/pasted directly from the W3C page, I see) have little
positive effect on performance between a proxy and a backend server that
exist on the same LAN or especially the same machine. They are mostly
of benefit between a server and a user-agent (browser) or over
slower-than-LAN links. Perhaps you should provide your own, actual
reasons (or better yet, test results) that demonstrate this is more than
an imagined fear. I'm fully prepared to believe that your app might
require HTTP/1.1, but copying reasons from the W3C site isn't entirely
No doubt there are many applications that would benefit from things like
chunked responses (I believe range requests should pass through
successfully, but haven't tested), but unless you are saying that you
have that sort of application, then I'd suggest you simply test and see
if it works. I've heard rumor that premature optimization is the root
of a significant amount of fail ;-)
> The 1.0 constraint is pretty dire for me. Do I have alternatives to
> proxy-pass/upstream that would allow me to use Nginx or should I be
> looking at another HTTP server?
If you really believe you need HTTP/1.1 between Nginx and the backend
(note that Nginx *does* support 1.1 to the browser), then you'll need to
look elsewhere. I believe that 1.1 support between Nginx and backend is
in the works, but sadly it doesn't exist today.
Sorry that I can't give you something more positive. But I do
encourage you to not give up unless actual testing (or some known
condition you haven't mentioned) demonstrates that HTTP/1.0 is a
demonstrable failure for your application.
More information about the nginx