Instantly share code, notes, and snippets.

Embed
What would you like to do?
Django middleware to capture X-Forwarded-Port header
class XForwardedPort(object):
def process_request(self, request):
try:
request.META['SERVER_PORT'] = 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