Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save negipo/860357 to your computer and use it in GitHub Desktop.
Save negipo/860357 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'webrick'
require 'webrick/httpproxy'
handler = Proc.new() do |req,res|
if (req.host == 'bodybrowser.googlelabs.com') && req.path =~ %r{/r3/assets/textures/}
res.body.gsub!(/0/m, rand(10).to_s)
res['cache-control'] = 'no-cache'
end
end
s = WEBrick::HTTPProxyServer.new(
:BindAddress => '0.0.0.0',
:Port => 8080,
:ProxyContentHandler => handler
)
Signal.trap('INT') do
s.shutdown
end
s.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment