Awesome, both $server_port amd $scheme work. $scheme is more awesome
though. Do you know by any chance where wsgi gets wsgi.url_scheme
from? Is there some header I can change where wsgi will read that its
https or http sos this works automatically? That'd be so much more
satisying.
On Oct 18, 4:53 am, "Graham Dumpleton" <[EMAIL PROTECTED]>
wrote:
> 2008/10/18 Graham Dumpleton <[EMAIL PROTECTED]>:
>
> > What does:
>
> > proxy_set_header X-Nginx-Port $server_port;
> > proxy_set_header X-Nginx-Host $host;
>
> > see HTTP_X_NGINX_PORT and HTTP_X_NGINX_HOST being set to in WSGI script
> > environ?
>
> Even better, what does:
>
> proxy_set_header X-Nginx-Scheme $scheme;
>
> end up as being.
>
> > Graham
>
> > 2008/10/18 Graham Dumpleton <[EMAIL PROTECTED]>:
> >> Can you show me the nginx configuration. Are the HTTP and HTTPS
> >> sections distinct such that we could put different proxy_set_header
> >> directives in each?
>
> >> May have to troll through nginx source code to find out what all the
> >> variables are that can be used as value for proxy_set_header.
>
> >> Graham
>
> >> 2008/10/18 MJBoa <[EMAIL PROTECTED]>:
>
> >>> When i try this out, HTTP_HOST has only the servername in it, no port.
> >>> And I don't see a way anywhere in the nginx documentation to get the
> >>> port that nginx got the request on.
>
> >>> On Oct 18, 3:52 am, "Graham Dumpleton" <[EMAIL PROTECTED]>
> >>> wrote:
> >>>> Hmmm, I am an idiot aren't I. If have:
>
> >>>> proxy_set_header Host $host;
>
> >>>> Then HTTP_HOST will have port 80/443 in it. The proxy_port is what the
> >>>> proxy is connecting to. Yes/No?
>
> >>>> Graham
>
> >>>> 2008/10/18 Graham Dumpleton <[EMAIL PROTECTED]>:
>
> >>>> > Can someone help me flesh out this nginx configuration, or tell me
> >>>> > whether doing things that aren't needed.
>
> >>>> > This is not for me, someone else is after it and want to understand
> >>>> > what is required.
>
> >>>> > What is desired is to have nginx in front of Apache/mod_wsgi. The
> >>>> > nginx would serve static files, and proxy dynamic requests to
> >>>> > Apache/mod_wsgi.
>
> >>>> > That bit is okay, but want nginx to listen for both HTTPS and HTTP
> >>>> > requests.
>
> >>>> > If nginx accepts both HTTPS and HTTP inbound requests, but the proxy
> >>>> > connections to Apache/mod_wsgi uses HTTP, then on Apache/mod_wsgi side
> >>>> > wsgi.url_scheme will be http for both the original HTTPS and HTTP
> >>>> > requests. Thus WSGI application can't tell if original request
> >>>> > received by nginx was secure. Note am assuming here that nginx
> >>>> > connection to Apache/mod_wsgi is via localhost and on secure box.
>
> >>>> > My assumption here is that nothing else in headers passed from nginx
> >>>> > will indicate that original request was HTTPS.
>
> >>>> > One way I saw as away around this was to use on nginx side:
>
> >>>> > proxy_set_header X-Proxy-Host $proxy_host;
>
> >>>> > This would have effect of setting header in proxied request of form:
>
> >>>> > X-Proxy-Host: originalhost:80
>
> >>>> > for HTTP and:
>
> >>>> > X-Proxy-Host: originalhost:443
>
> >>>> > for HTTPS.
>
> >>>> > In the WSGI script file for Apache/mod_wsgi, could then use a WSGI
> >>>> > middleware to do something like:
>
> >>>> > def application(environ, start_response):
> >>>> > if environ['HTTP_X_PROXY_HOST'].split(':')[1] == '443':
> >>>> > environ['wsgi.url_scheme'] = 'https'
>
> >>>> > return _application(environ, start_response)
>
> >>>> > For nginx as front end to Apache/mod_wsgi does this make sense and/or
> >>>> > is there a better way of getting to the Apache/mod_wsgi a flag
> >>>> > indicating that original request was HTTPS rather than plain HTTP.
>
> >>>> > Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---