Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install djb.headerproxy

How to install djb.headerproxy

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install djb.headerproxy
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1.1 Available View build log
Windows (64-bit)
0.1.1 Available View build log
Mac OS X (10.5+)
0.1.1 Available View build log
Linux (32-bit)
0.1.1 Available View build log
Linux (64-bit)
0.1.1 Available View build log
Lastest release
version 0.1.1 on Nov 21st, 2012


Simple package that extends the proxy object within Paste to allow the WSGI proxy to read its connection location from arbitrary headers. It will keep all other headers (including Host: intact during transit); you may or may not need to adjust what you're doing upstream accordingly.


By default, the proxy will read the host to connect to from the X-Proxy-Force-Host header and read the connection scheme from X-Proxy-Force-Scheme.

You can override these using relevant configuration like follows. Keep in mind that at time of proxy, we're reading headers from the environ dictionary, so specify your headers in this manner. For instance, X-Proxy-Foobar will become visible in the environ dict as HTTP_PROXY_FOOBAR (noting dashes to underscores, and replacement of X with HTTP). You can make this mapping happen thusly:

use = egg:djb.headerproxy

The above example is overly verbose, however, as we already default to using these specific headers. This does demonstrate how you can customise this behaviour to suit you -- for instance, if your front-end automatically provides some headers, you can configure the mapping accordingly.


If unprotected, this WSGI middleware could be used as an open proxy since headers can easily be spoofed. You should take steps to either firewall off your application, drop headers at an upstream web server, run this as a local socket, or do something similar (or all of the above!).

You've been warned.

Source code

Available on GitHub at http://github.com/davidjb/djb.headerproxy/ - fork away!


David Beitey, Author


0.1.1 (2012-08-09)
  • Add a main entry point as well - this is just an alias to the same proxy app. [davidjb]
0.1 (2012-08-03)
  • Initial creation of proxy that uses header-based configuration. [davidjb]
  • Package created using templer [davidjb]

Subscribe to package updates

Last updated Nov 21st, 2012

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.