Created
May 24, 2012 16:59
-
-
Save ryanhanks/2782797 to your computer and use it in GitHub Desktop.
The Tom Cat Server Proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rvm use 1.9.3@tccs_proxy --create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This Sinatra app proxies requests to the tomcat server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './tccs_proxy' | |
run TccsProxy.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'rack-proxy', :git => 'https://github.com/ncr/rack-proxy.git' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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