diff --git a/bifrost/views.py b/bifrost/views.py index 0b7115f..08c31c0 100644 --- a/bifrost/views.py +++ b/bifrost/views.py @@ -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 {}