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
-~----------~----~----~----~------~----~------~--~---

Reply via email to