Index: wsgi.py
===================================================================
--- wsgi.py	(revision 6006)
+++ wsgi.py	(working copy)
@@ -70,6 +70,8 @@
         environ['wsgi.url_scheme'] = 'http'
         if environ.get('HTTPS', '').lower() in ('yes', 'on', '1'):
             environ['wsgi.url_scheme'] = 'https'
+        elif environ.get('HTTP_X_FORWARDED_PROTO', '').lower() == 'https':
+            environ['wsgi.url_scheme'] = 'https'
         environ['wsgi.input'] = stdin
         environ['wsgi.errors'] = stderr
         environ['wsgi.multithread'] = self.wsgi_multithread

