|
|
@@ -94,13 +94,12 @@ def esegue_conversione(inputfile):
|
|
|
def frontpage(request):
|
|
|
print(__name__)
|
|
|
listaccepted = list()
|
|
|
+ listaccepted.append('127.0.0.1')
|
|
|
|
|
|
if 'REMOTE' in os.environ:
|
|
|
remote = os.environ['REMOTE'].split(',')
|
|
|
-
|
|
|
- listaccepted.append('127.0.0.1')
|
|
|
- for r in remote:
|
|
|
- listaccepted.append(r)
|
|
|
+ for r in remote:
|
|
|
+ listaccepted.append(r)
|
|
|
|
|
|
print(request.META)
|
|
|
if 'x_real_ip'.upper() in request.META:
|
|
|
@@ -108,7 +107,9 @@ def frontpage(request):
|
|
|
if 'http_host'.upper() in request.META:
|
|
|
print('http_host',request.META['HTTP_HOST'])
|
|
|
if 'remote_address'.upper() in request.META:
|
|
|
- print('remote_addrews',request.META['REMOTE_ADDR'])
|
|
|
+ print('remote_addr',request.META['REMOTE_ADDR'])
|
|
|
+ if 'http_x_forwarded_for'.upper() in request.META:
|
|
|
+ print('http_x_forwarded_for',request.META['HTTP_X_FORWARDED_FOR'])
|
|
|
|
|
|
auth = False
|
|
|
|
|
|
@@ -125,6 +126,10 @@ def frontpage(request):
|
|
|
if request.META['REMOTE_ADDR'] in listaccepted:
|
|
|
print('found presente REMOTE_ADDR',request.META['REMOTE_ADDR'])
|
|
|
auth = True
|
|
|
+ if 'HTTP_X_FORWARDED_FOR' in request.META:
|
|
|
+ if request.META['HTTP_X_FORWARDED_FOR'] in listaccepted:
|
|
|
+ print('found presente HTTP_X_FORWARDED_FOR',request.META['HTTP_X_FORWARDED_FOR'])
|
|
|
+ auth = True
|
|
|
|
|
|
|
|
|
if not auth:
|