mirror of
https://github.com/evennia/evennia.git
synced 2026-03-19 06:16:31 +01:00
Updated X-Forwarded-For to better conform to spec (multiple proxies).
This commit is contained in:
parent
175b9b7338
commit
d5129b5065
1 changed files with 4 additions and 4 deletions
|
|
@ -30,13 +30,13 @@ class HTTPChannelWithXForwardedFor(http.HTTPChannel):
|
|||
"""
|
||||
Check to see if this is a reverse proxied connection.
|
||||
"""
|
||||
IP = 0
|
||||
PORT = 1
|
||||
CLIENT = 0
|
||||
http.HTTPChannel.allHeadersReceived(self)
|
||||
req = self.requests[-1]
|
||||
client_ip, port = self.transport.client
|
||||
forwarded = req.getHeader('X-FORWARDED-FOR')
|
||||
if forwarded and client_ip in UPSTREAM_IPS:
|
||||
proxy_chain = req.getHeader('X-FORWARDED-FOR')
|
||||
if proxy_chain and client_ip in UPSTREAM_IPS:
|
||||
forwarded = proxy_chain.split(', ', 1)[CLIENT]
|
||||
self.transport.client = (forwarded, port)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue