提交 ee55403c 编写于 作者: B Ben Darnell

Support X-Forwarded-Proto in addition to X-Scheme

上级 7ed8fbe1
......@@ -437,7 +437,11 @@ class HTTPRequest(object):
# Squid uses X-Forwarded-For, others use X-Real-Ip
self.remote_ip = self.headers.get(
"X-Real-Ip", self.headers.get("X-Forwarded-For", remote_ip))
self.protocol = self.headers.get("X-Scheme", protocol) or "http"
# AWS uses X-Forwarded-Proto
self.protocol = self.headers.get(
"X-Scheme", self.headers.get("X-Forwarded-Proto", protocol))
if self.protocol not in ("http", "https"):
self.protocol = "http"
else:
self.remote_ip = remote_ip
self.protocol = protocol or "http"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册