You might have whitnessed yourself that even though lvho.st/foo
might not work, lvho.st/foo/
(with a trailing slash) however does! So the question is how to either skip checking for the trailing slash or append it to all requests. The problem can be solved with a small .htaccess
redirect on a Passenger / Apache server, but we're in Ruby, so here's the Ruby solution - the rack-slashenforce gem.
Run this in your project folder (or append it to your Gemfile and run bundle install
):
gem install rack-slashenforce
Then your Ruby file would look like this:
require 'rack-slashenforce'
# Make sure you declare this outside the map block
use Rack::AppendTrailingSlash
map "/foo" do
use Rack::Static, :urls => [""], :root => 'public', :index => 'admin.html'
run lambda {|env| [200, {}, []]}
end
Now every call to lvho.st/foo
will get a slash appended! And everything should work fine.