summary refs log tree commit diff
path: root/synapse/rest/register.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/rest/register.py')
-rw-r--r--synapse/rest/register.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/rest/register.py b/synapse/rest/register.py
index 3c8929cf9b..5872a11d80 100644
--- a/synapse/rest/register.py
+++ b/synapse/rest/register.py
@@ -66,8 +66,11 @@ class RegisterRestServlet(RestServlet):
             
             # TODO determine the source IP : May be an X-Forwarding-For header depending on config
             ip_addr = request.getClientIP()
-            #if self.hs.config.captcha_ip_origin_is_x_forwarded:
-            #    # use the header
+            if self.hs.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]
             
             captcha = {
                 "ip": ip_addr,