mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-06 10:25:02 -04:00
Correctly handle x_forwaded listener option
This commit is contained in:
parent
fd2c07bfed
commit
9c5fc81c2d
3 changed files with 31 additions and 14 deletions
|
@ -132,16 +132,8 @@ class BaseHomeServer(object):
|
|||
setattr(BaseHomeServer, "get_%s" % (depname), _get)
|
||||
|
||||
def get_ip_from_request(self, request):
|
||||
# May be an X-Forwarding-For header depending on config
|
||||
ip_addr = request.getClientIP()
|
||||
if self.config.captcha_ip_origin_is_x_forwarded:
|
||||
# use the header
|
||||
if request.requestHeaders.hasHeader("X-Forwarded-For"):
|
||||
ip_addr = request.requestHeaders.getRawHeaders(
|
||||
"X-Forwarded-For"
|
||||
)[0]
|
||||
|
||||
return ip_addr
|
||||
# X-Forwarded-For is handled by our custom request type.
|
||||
return request.getClientIP()
|
||||
|
||||
def is_mine(self, domain_specific_string):
|
||||
return domain_specific_string.domain == self.hostname
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue