skip to navigation
skip to content

wsgi-aws-unproxy 1.1.0

Simple wsgi middleware to unproxy AWS

Set the correct REMOTE_ADDR based on the X-Forwarded-For header, while only trusting the CloudFront IP addresses.

This module is applied as WSGI middleware, fixing the IP-address retrieval for the entire application in a secure manner. As extra benefit, external packages no longer have to write abstraction layers to retrieve the IP-address header.

Django example

In Django edit the file to apply the module:

from django.core.wsgi import get_wsgi_application
from wsgi_aws_unproxy import UnProxy

application = get_wsgi_application()
application = UnProxy(application)

Now all packages can just read request.META['REMOTE_ADDR'] to fetch the correct IP. This includes contact forms, Sentry error reporting and rate limiting tools.


You can install the latest version using pip:

pip install wsgi-aws-unproxy

And apply it as WSGI middleware:

from wsgi_aws_unproxy import UnProxy

application = UnProxy(application)
File Type Py Version Uploaded on Size
wsgi-aws-unproxy-1.1.0.tar.gz (md5, pgp) Source 2017-06-08 4KB
wsgi_aws_unproxy-1.1.0-py2.py3-none-any.whl (md5, pgp) Python Wheel py2.py3 2017-06-08 4KB