WsgiUnproxy
When an HTTP proxy forwards traffic to a webserver, the server sees the proxy IP address rather than the original client IP address. Since the server may need the IP address for logging or authentication purposes, many HTTP proxies add an X-Forwarded-For header indicating the original client IP address.
As WSGI middleware, WsgiUnproxy sits between the WSGI server and your WSGI application. Before your application sees a request, WsgiUnproxy removes the X-Forwarded-For header and reinstates the client IP address, yielding a request that looks like it was never proxied to begin with.
Since anyone can add an X-Forwarded-For header, WsgiUnproxy only uses the header if it comes from a trusted proxy IP addresses.
Example WSGI application
from wsgiunproxy import unproxy
@unproxy(trusted_proxies=[ '1.2.3.4', '5.6.7.8' ])
def application(environ, start_response):
start_response('200 OK', [])
return ['Your IP address is %s.' % environ.get('REMOTE_ADDR')]
Use with Paste Deployment
WsgiUnproxy can be used in a Paste Deployment pipeline:
[pipeline:main]
pipeline =
WsgiUnproxy
MyApp
[filter:WsgiUnproxy]
use = egg:WsgiUnproxy
trusted_proxies = 1.2.3.4, 5.6.7.8
Advanced use
If you need to specify a lot of trusted proxies (such as a whole subnet), you don’t have to use give trusted_proxies as a list. All that WsgiUnproxy asks is that trusted_proxies supports the in operator (e.g. by implementing __contains__).
License
To the extent possible under law, the author has waived all copyright and related or neighboring rights to WsgiUnproxy.
For more information see: http://creativecommons.org/publicdomain/zero/1.0/
Metadata
Release files for WsgiUnproxy 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| WsgiUnproxy-1.0.tar.gz | 2.9 kB | Without provenance | Details for WsgiUnproxy-1.0.tar.gz |
Release files / WsgiUnproxy-1.0.tar.gz
| Download URL | WsgiUnproxy-1.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
186903611ae8bbc2936deeeb649f222f973a1774ded9434de4db0716b501af95
|
|
BLAKE2b-256 checksum How to use checksums |
47d76f7bb56bf175b584922139f3b94c8444dd6b5c7ae541f75e2850bf607d2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for WsgiUnproxy 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.