Fix: The auto-detected ip was wrong as the forwarded address was always 127.0.0.1
This commit is contained in:
parent
107be1af8c
commit
82f290a206
@ -16,7 +16,11 @@ def update_view(request):
|
||||
password = request.registry.settings['webfaction.password']
|
||||
current_ip = request.GET.get('ip',None)
|
||||
if current_ip is None:
|
||||
current_ip = request.remote_addr
|
||||
if 'X-Forwarded-For' in request.headers:
|
||||
current_ip = request.headers['X-Forwarded-For']
|
||||
else:
|
||||
current_ip = request.remote_addr
|
||||
|
||||
domain = request.GET['domain']
|
||||
db = load(file)
|
||||
|
||||
@ -28,7 +32,7 @@ def update_view(request):
|
||||
db[domain] = current_ip
|
||||
update(file, db)
|
||||
|
||||
log.info('{0} updated to {1} at {3}'.format(domain, current_ip))
|
||||
log.info('{0} updated to {1}'.format(domain, current_ip))
|
||||
else:
|
||||
log.info('{0} not updated'.format(domain))
|
||||
return {}
|
||||
|
Loading…
Reference in New Issue
Block a user