You are correct that Rack::URLMap does not treat '*' in the path as a wildcard. The actual translation from the regex path is as follows:
Regexp.new("^#{Regexp.quote(location).gsub('/', '/+')}(.*)", nil, 'n')
That is, it treats any characters in the path as literals, but also matches the path with any suffix. I believe that the only way to achieve what you are trying is to use middleware instead of the endpoint. In your config.ru you might have something like this:
use SimpleAdapter run Rack::File
And your lib/simple_adapter.rb might look something like this:
class SimpleAdapter SLASH_OR_INDEX = %r{/(?:index)?} def initialize(app) @app = app end def call(env) request = Rack::Request.new(env) if request.path =~ SLASH_OR_INDEX
source share