Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Simple wsgi middleware to unproxy AWS

Project description

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)

Project details

Release history Release notifications

This version
History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
wsgi_aws_unproxy-1.1.0-py2.py3-none-any.whl (4.7 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jun 8, 2017
wsgi-aws-unproxy-1.1.0.tar.gz (4.2 kB) Copy SHA256 hash SHA256 Source None Jun 8, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page