Documentation for pulsar 0.7.3. For development docs, go here.
The code for this example is located in the examples.proxyserver.manage module.
An asynchronous multi-process HTTP proxy server
It is possible to add middleware to manipulate the original request headers. If the header middleware is an empty list, the proxy passes requests and responses unmodified. This is an implementation for a forward-proxy which can be used to retrieve any type of source from the Internet.
To run the server:
An header middleware is a callable which receives the wsgi environ and the list of request headers. By default the example uses:
Add x-forwarded-for header
To run with different headers middleware create a new script and do:
from proxyserver.manage import server if __name__ == '__main__': server(headers_middleware=[...]).start()
WSGI middleware for an asynchronous proxy server. To perform processing on headers you can pass a list of headers_middleware. An headers middleware is a callable which accepts two parameters, the wsgi environ dictionary and the headers container.
Fill request headers from the environ dictionary and modify the headers via the list of headers_middleware. The returned headers will be sent to the target uri.