jaswope/rack-reverse-proxy — pull request #26 by peterwald (2012-10-11 03:10:15+00:00)
Title: Added a feature to optionally post process the body of a proxied response.

Allows user to easily post-process the http body before sending it back through the Rack pipeline. This is implemented by allowing a block to be passed to the reverse_proxy statement. The block will be called for each request after the body is received from the origin server. The return value of the block is passed back up the stack. We don't allow changing any of the headers or status at this stage.

*This function can be used to replace hrefs in the body or to filter content, etc…*

Example:

```
reverse_proxy '/test', 'http://example.com' do |body|
# replace any urls in the body that reference example.com with the new path.
body.gsub 'http://example.com/', '/test/'
end
```