Add utils app
This commit is contained in:
parent
72c3149cc0
commit
6a74124adf
24 changed files with 4235 additions and 0 deletions
17
utils/middleware.py
Executable file
17
utils/middleware.py
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue