Skip to content

Instantly share code, notes, and snippets.

@mattrobenolt
Created January 3, 2013 00:07
Show Gist options
  • Save mattrobenolt/4439597 to your computer and use it in GitHub Desktop.
Save mattrobenolt/4439597 to your computer and use it in GitHub Desktop.
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