Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


URLMap: why any-domain-routes have more priority than domain-specific-routes? #504

runa opened this Issue · 2 comments

2 participants


Heyas, we spent our afternoon trying to figure out if this is a bug or a feature.

We have 2 routes:

  "/" => app1,
  "" => app2,

When requesting curl the route for app1 matches (instead of the expected app2).

I think specific-domain-routes should be matched BEFORE any-domain routes. This could be easily fixed by setting INFINITY weight to any-domain routes instead of NEGATIVE_INFINITY (see ).

The problem, is that when we did that, (this test fails)[]. I couldn't understand why that test expects a response from when requesting a URL

So, the big question is: is this a bug or a feature?

There's a gist here displaying the behavior

Thanks a lot!


Interesting, I see your issue, but it's not related to the priorities. Currently, we don't handle Hosts that aren't coming in from SERVER_NAME or HTTP_HOST headers. As a consequence of not having supported this previously (this may be related to the CGI spec, I need to do some research), Rack::MockRequest drops the host information during env creation.


Fail. There are a few odd paths, but essentially, you're absolutely correct. Patch applied. Thank you!

@raggi raggi closed this in 60c66b5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.