Rework on Docker image
This commit is contained in:
parent
518de596bb
commit
b46854e479
6 changed files with 56 additions and 20 deletions
|
|
@ -50,8 +50,10 @@ class SessionMiddleware(object):
|
|||
|
||||
def __call__(self, request):
|
||||
user = request.user
|
||||
if 'HTTP_X_FORWARDED_FOR' in request.META:
|
||||
ip = request.META.get('HTTP_X_FORWARDED_FOR')
|
||||
if 'HTTP_X_REAL_IP' in request.META:
|
||||
ip = request.META.get('HTTP_X_REAL_IP')
|
||||
elif 'HTTP_X_FORWARDED_FOR' in request.META:
|
||||
ip = request.META.get('HTTP_X_FORWARDED_FOR').split(', ')[0]
|
||||
else:
|
||||
ip = request.META.get('REMOTE_ADDR')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue