I have a Rack server where I run multiple websites.
use Rack::Session::Cookie
app = lambda do |env|
case
# Kek Mobile
when env[\'HTTP_HOST\'] =~ /mobi.k
I believe the URLMap middleware will solve your problem, or at least put you on the right track.
As you can see, URLMap lets you supply a different middleware pipeline for each app:
use Rack::Lint
map "/" do
use Rack::CommonLogger
run our_test_app
end
map "/lobster" do
use Rack::ShowExceptions
run Rack::Lobster.new
end
From your example, it's clear that this will not work directly, since you are mapping based on the HTTP host. However, the official docs mention, "Support for HTTP/1.1 host names exists if the URLs start with http:// or https://." So, perhaps you can call map "http://mobi.kek.com"
and map "http://fb.kek.com"
.
Good luck!