dynamicweb2/utils/middleware.py

18 lines
595 B
Python
Raw Normal View History

2023-12-06 11:16:30 +00:00
#class MultipleProxyMiddleware(object):
# FORWARDED_FOR_FIELDS = [
# 'HTTP_X_FORWARDED_FOR',
# 'HTTP_X_FORWARDED_HOST',
# 'HTTP_X_FORWARDED_SERVER',
# ]
#
# def process_request(self, request):
# """
# Rewrites the proxy headers so that only the most
# recent proxy is used.
# """
# for field in self.FORWARDED_FOR_FIELDS:
# if field in request.META:
# if ',' in request.META[field]:
# parts = request.META[field].split(',')
# request.META[field] = parts[-1].strip()