Skip to content

Instantly share code, notes, and snippets.

@sj26
Created May 13, 2011 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sj26/969897 to your computer and use it in GitHub Desktop.
Save sj26/969897 to your computer and use it in GitHub Desktop.
Multiple rack applications mounted inside each other
require 'rack'
use Rack::ContentLength
use Rack::ContentType
run proc { |env| [200, {}, '<p>First application</p><p><a href="/bar">Go to Second Application</a></p>'] }
require 'rack'
use Rack::ContentLength
use Rack::ContentType
run proc { |env| [200, {}, '<p>Second application</p><p><a href="/">Go to First Application</a></p>'] }
require 'rack'
run Rack::URLMap.new \
"/" => Rack::Builder.parse_file('app1.ru').first,
"/bar" => Rack::Builder.parse_file('app2.ru').first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment