This module implements a tiny HTTP proxy by extending BaseHTTPServer. Supports the GET, HEAD, POST, PUT, DELETE and CONNECT methods.
The latest version can be installed via PyPI:
$ pip install httproxy
$ easy_install httproxy
httproxy [options] httproxy [options] <allowed-client> ...
-h, --help Show this screen. --version Show version and exit. -H, --host HOST Host to bind to [default: 127.0.0.1]. -p, --port PORT Port to bind to [default: 8000]. -l, --logfile PATH Path to the logfile [default: STDOUT]. -i, --pidfile PIDFILE Path to the pidfile [default: httproxy.pid]. -d, --daemon Daemonize (run in the background). The default logfile path is httproxy.log in this case. -c, --configfile CONFIGFILE Path to a configuration file. -v, --verbose Log headers.
To start the proxy server and bind it to port 22222 (the port on which it will listen and accept connections):
httproxy -p 22222
To start the proxy server, bind it to port 22222 and tell it to log all requests to the file httproxy.log:
httproxy -p 22222 -l httproxy.log
To start the proxy server so it only allows connections from IP 18.104.22.168:
To start the proxy server bound to port 22222, log to file httproxy.log and run the server in the background (as a daemon):
httproxy -p 22222 -l httproxy.log -d
Every option stated as a command-line argument can be passed using a configuration file. httproxy looks for the following files to read configuration:
The names of the settings in the main section are derived from the long command line option names.
The allowed-clients section holds a list of hostnames that can access the proxy, one hostname per line. Remove this section or leave empty to allow any client to connect.
An example file:
[main] host = localhost port = 8011 logfile = /Users/ambv/.httproxy/log pidfile = /Users/ambv/.httproxy/pid daemon = yes verbose = yes [allowed-clients] localhost 192.168.0.1
Note: command-line options have precedence over configuration file settings.
If you install setproctitle, the name of the process reported by ps will be more descriptive.
If you install psutil, httproxy will be able to automatically remove stale pidfiles on startup.
Upgraded by Mitko Haralanov in 2009.
TODO: Figure out how to actually get changelog content.
Changelog content for this version goes here.