Last active
August 29, 2015 14:06
-
-
Save lakenen/c80c1f47edf88ad8ded9 to your computer and use it in GitHub Desktop.
Django middleware to capture X-Forwarded-Host and X-Forwarded-Port headers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class XForwarded(object): | |
def process_request(self, request): | |
try: | |
request.META['HTTP_HOST'] = request.META['HTTP_X_FORWARDED_HOST']) + ":" + str(request.META['HTTP_X_FORWARDED_PORT']) | |
except KeyError: | |
pass | |
return None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment