Skip to content

Instantly share code, notes, and snippets.

@ryanhanks
Created May 24, 2012 16:59
Show Gist options
  • Save ryanhanks/2782797 to your computer and use it in GitHub Desktop.
Save ryanhanks/2782797 to your computer and use it in GitHub Desktop.
The Tom Cat Server Proxy
rvm use 1.9.3@tccs_proxy --create
This Sinatra app proxies requests to the tomcat server
require './tccs_proxy'
run TccsProxy.new
source 'http://rubygems.org'
gem 'rack-proxy', :git => 'https://github.com/ncr/rack-proxy.git'
GIT
remote: https://github.com/ncr/rack-proxy.git
revision: 85230cc147551a02a32abc25bcd890ab6a07eca3
specs:
rack-proxy (0.3.7)
rack
GEM
remote: http://rubygems.org/
specs:
rack (1.4.1)
PLATFORMS
ruby
DEPENDENCIES
rack-proxy!
class TccsProxy < Rack::Proxy
puts "reloading"
def rewrite_env(env)
p env
env["HTTP_HOST"] = "secure.mbctestweb.com:8080"
# env['']
env
end
def rewrite_response(triplet)
status, headers, body = triplet
# p triplet
# triplet
# b = body.to_s
# puts b
# p status, headers
headers.delete("transfer-encoding")
[status, headers, body]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment