Skip to content

Instantly share code, notes, and snippets.

@tie-rack
Created May 4, 2010 16:07
Show Gist options
  • Save tie-rack/389589 to your computer and use it in GitHub Desktop.
Save tie-rack/389589 to your computer and use it in GitHub Desktop.
# Run the little Sinatra app on port 3000 and the big Rails app on
# port 3001. Run this file and hit them both at port 4000.
require 'rubygems'
require 'rack/proxy'
require 'thin'
class LittleProxy < Rack::Proxy
def rewrite_env(env)
if env['PATH_INFO'].match(/^\/little\//)
env['SERVER_PORT'] = '3000'
else
env['SERVER_PORT'] = '3001'
end
env
end
end
Rack::Handler::Thin.run(LittleProxy.new, :Port => 4000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment