Skip to main content

Paste proxies with the ability to proxy to a location based upon an incoming header

Project description

Introduction

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.

Configuration

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:

[app:proxy]
use = egg:djb.headerproxy#header_proxy
force_host = HTTP_PROXY_FORCE_HOST
force_scheme = HTTP_PROXY_FORCE_SCHEME

The above example is overly verbose, however, as we already default to using these specific headers.

Warning

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!

Contributors

David Beitey, Author

Changelog

0.1 (2012-08-03)

  • Initial creation of proxy that uses header-based configuration. [davidjb]

  • Package created using templer [davidjb]

Project details


Download files

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

Source Distribution

djb.headerproxy-0.1.zip (15.3 kB view details)

Uploaded Source

File details

Details for the file djb.headerproxy-0.1.zip.

File metadata

  • Download URL: djb.headerproxy-0.1.zip
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for djb.headerproxy-0.1.zip
Algorithm Hash digest
SHA256 720040f9707cde08891b1a82387cead5c7891b162fd79d897d5432e12caf304b
MD5 0b76721e81f1df1ff72983e548c6e470
BLAKE2b-256 583f0c6d2892a62d4f4f2c349cf742044b52b044175f70f8092e37c8ce9a6cc3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page