mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
fix issue #51. Support https schema. Pas an Http header to gunicorn :
X-Forwarded-Protocol=https , X-Forwarded-Ssl=on
This commit is contained in:
parent
b4d4427416
commit
e06b44a28f
@ -102,6 +102,12 @@ class Request(object):
|
||||
client_address = self.client_address or "127.0.0.1"
|
||||
forward_adress = self.parser.headers_dict.get('X-Forwarded-For',
|
||||
client_address)
|
||||
|
||||
if self.parser.headers_dict.get("X-Forwarded-Protocol") == "https" or \
|
||||
self.parser.headers_dict.get("X-Forwarded-Ssl") == "on":
|
||||
url_scheme = "https"
|
||||
else:
|
||||
url_scheme = "http"
|
||||
|
||||
if isinstance(forward_adress, basestring):
|
||||
# we only took the last one
|
||||
@ -129,7 +135,7 @@ class Request(object):
|
||||
path_info = path_info.split(script_name, 1)[-1]
|
||||
|
||||
environ = {
|
||||
"wsgi.url_scheme": 'http',
|
||||
"wsgi.url_scheme": url_scheme,
|
||||
"wsgi.input": wsgi_input,
|
||||
"wsgi.errors": sys.stderr,
|
||||
"wsgi.version": (1, 0),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user