Python Paste


WSGIProxyMiddleware

Fixes up the environment given special headers set by WSGIProxy, or by configuration.

Accepts the configuration:

secret_file:

A location where a secret is kept, used to sign the request when its coming from wsgiproxy.app

trust_ips:

Instead of secret_file you can give a list of IPs that are trusted. Trusted hosts can send pickle headers.

prefix:

This is used for explicitly configuring the value of SCRIPT_NAME. A request to /foo with prefix='/bar' will result in a SCRIPT_NAME of '/bar' and a PATH_INFO of '/foo'.

pop_prefix:

This is a prefix that is popped off the actual request path, and put into SCRIPT_NAME. A request to /bar/foo where pop_prefix='/bar' will result in a SCRIPT_NAME of '/bar' and a PATH_INFO of '/foo'.

scheme:

Force the scheme; e.g., to 'https'

host:

Force the host (including port!). You must give something like foo.com:80. This will replace the HTTP_HOST value, as well as SERVER_NAME and SERVER_PORT.

domain:

Force the domain (not including port). If you give foo.com it will rewrite HTTP_HOST to be foo.com:{port}, with whatever port was used for the actual request. Usually host will be more useful. Also SERVER_NAME will be set.

port:

Force the port (not including domain). If you give 80 it will set SERVER_PORT and the port portion of HTTP_HOST.

Methods

f __init__(self, application, secret_file=None, trust_ips=None, prefix=None, pop_prefix=None, scheme=None, host=None, domain=None, port=None) ...

f __call__(self, environ, start_response) ...

f str_decode(self, value) ...

f unicode_decode(self, value) ...

f json_decode(self, value) ...

f pickle_decode(self, value) ...

See the source for more information.