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 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. 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.
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.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]
Metadata
Release files for djb.headerproxy 0.1.1
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 | |
|---|---|---|---|---|
| djb.headerproxy-0.1.1.zip | 15.8 kB | Without provenance | Details |
Release files / djb.headerproxy-0.1.1.zip
| Download URL | djb.headerproxy-0.1.1.zip |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c261836cc5e2c85966db74b4c101e66cb9b6a854f7b688e82ee17885d8684baa
|
|
BLAKE2b-256 checksum How to use checksums |
f57d5dc9703da4120cfeee56da89a730a7a0535c5801be23d287ff7e1d2aaed5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for djb.headerproxy 0.1.1
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.