Suggestion for improvement of examples/nginx.conf

Eric Wong normalperson at yhbt.net
Tue Mar 20 19:59:58 UTC 2012


Eric Wong <normalperson at yhbt.net> wrote:
> Eike Herzbach <eike at herzbach.net> wrote:
> > Hi,
> > 
> > what do you think about that:
> > 
> > diff --git a/examples/nginx.conf b/examples/nginx.conf
> > index cc1038a..5ef43f3 100644
> > --- a/examples/nginx.conf
> > +++ b/examples/nginx.conf
> > @@ -55,7 +55,7 @@ http {
> >    # faster or not than doing compression via nginx.  It's easier
> >    # to configure it all in one place here for static files and also
> >    # to disable gzip for clients who don't get gzip/deflate right.
> > -  # There are other other gzip settings that may be needed used to deal with
> > +  # There are other gzip settings that may be needed used to deal with
> 
> Obviously correct, will apply.  Thanks.

Pushed:
http://bogomips.org/unicorn.git/patch/?id=0daedd92d3e896a9fcd301bbb58e85bb54a939ee

> > -      # enable this if and only if you use HTTPS, this helps Rack
> > +      # enable this if you use HTTPS, this helps Rack
> >        # set the proper protocol for doing redirects:
> > -      # proxy_set_header X-Forwarded-Proto https;
> > +      # proxy_set_header X-Forwarded-Proto $scheme;
> > 
> >        # pass the Host: header from the client right along so redirects
> >        # can be set properly within the Rack application
> > 
> > I haven't found an easy way to only set the header if the scheme is
> > https, but I don't see any problems in sending the header for all
> > requests either.
> 
> Setting it for all requests uses an extra hash slot and leads to extra
> method dispatches in Rack (and possibly code elsewhere).  I suppose
> it doesn't matter for most setups, though.
> 
> How about this?
> 
> --- a/examples/nginx.conf
> +++ b/examples/nginx.conf
> @@ -120,9 +120,9 @@ http {
>        #   http://en.wikipedia.org/wiki/X-Forwarded-For
>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>  
> -      # enable this if and only if you use HTTPS, this helps Rack
> -      # set the proper protocol for doing redirects:
> -      # proxy_set_header X-Forwarded-Proto https;
> +      # enable this if you forward HTTPS traffic to unicorn,
> +      # this helps Rack set the proper URL scheme for doing redirects:
> +      # proxy_set_header X-Forwarded-Proto $scheme;
>  
>        # pass the Host: header from the client right along so redirects
>        # can be set properly within the Rack application

Also pushed this:

http://bogomips.org/unicorn.git/patch/?id=9fc5c24920726d3c10bc9f39d8e97686b93cbbe0


More information about the mongrel-unicorn mailing list