diff --git a/boards/views.py b/boards/views.py --- a/boards/views.py +++ b/boards/views.py @@ -49,7 +49,7 @@ def new_post(request, thread_id=boards.m else: image = None - ip = request.META['REMOTE_ADDR'] + ip = _get_client_ip(request) tags = [] @@ -181,4 +181,13 @@ def all_tags(request): def _get_theme(request): - return request.session.get('theme', neboard.settings.DEFAULT_THEME) \ No newline at end of file + return request.session.get('theme', neboard.settings.DEFAULT_THEME) + + +def _get_client_ip(request): + x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') + if x_forwarded_for: + ip = x_forwarded_for.split(',')[-1].strip() + else: + ip = request.META.get('REMOTE_ADDR') + return ip \ No newline at end of file