Jetty is a powerful embedded web container / web server. Among many other features it has support for proxies. This is some small proxy utilities based on Jettys proxy capability. Note that it is less than a hundred lines of mine on top of Jetty per proxy, so my contribution is pretty small.
Proxies:
Java 5 or newer.
cd <location> unzip proxy-bin unzip win
set def <location> unzip proxy-bin set file/attr=rfm:stmlf *.jar unzip -aa vms
<location>null ...
or:
<location>limit ...
or:
<location>slow ...
or:
<location>header ...
or:
<location>log ...
@<location>null ...
or:
@<location>limit ...
or:
@<location>slow ...
or:
@<location>header ...
or:
@<location>log ...
Standard transperent proxy. This can be useful for network/port reasons.
Command:
null listenport forwardurl_prefix
Arguments:
Example:
null 10080 http://localhost:80
This proxy will:
Limit number of concurrent requests for some resources. This can be useful to protect the server from being overwhelmed by requests.
Command:
limit listenport forwardurl_prefix targetpath_prefix concurrencylimit busyurl verbose
Arguments:
Example:
limit 10080 http://localhost:80 /script 10 http://localhost/busy.html 1
This proxy will:
Slow down response to some resources. This can be useful to simulate slow network.
Command:
slow listenport forwardurl_prefix targetpath_prefix delay
Arguments:
Example:
slow 10080 http://localhost:80 /foo 500
This proxy will:
Modify headers in request. This can be useful to insert something the server requires.
Command:
header listenport forwardurl_prefix targetpath_prefix hdr1 hdrval1 ... hdrn hdrvaln
Arguments:
Example:
header 10080 http://localhost:80 /bar User-Agent "None of your business" X-Dummy Nothing
This proxy will:
User-Agent: None of your business X-Dummy: Nothing
Logs requests and responses for some resources. This can be useful for troubleshooting.
Note that it just logs headers and byte count for body - not full body (that would be problematic for some types of content).
Command:
log listenport forwardurl_prefix targetpath_prefix logfile
Arguments:
Important: requests will be serialized to avoid messing up log output - this will impact performance.
Example:
log 10080 http://localhost:80 /foobar foobar.log
This proxy will:
Both my code and the Jetty code are available under Apache 2.0 license.