Setting up routes with formats and parameters that are domain names

## Configuration This is on Rails running on ruby 1.8.4

## in config/routes.rb map.somecontroller_show 'somecontroller/:id.:format',   :requirements => {:id => /\w[^\/?;]*/ },   :controller => 'somecontroller', :action => 'show',   :conditions => { :method => :get }

## the problem :id for this controller is a domain name. The path to this route will look like this: GET /somecontroller/ - for when the user wants a specific format or GET /somecontroller/ - for when the user requests the default format

For the first path params should be {:action => 'show', :controller => 'somecontroller', :id => '', :format => 'xml'} but end up being {:action => 'show', :controller => 'somecontroller', :id => ''}

For the second path params should be {:action => 'show', :controller => 'somecontroller', :id => ''} and work properly.

The problem is with this route I can not extract the format because it is getting matched by the :id regular expression. I could change the :id regular expression to be not greedy which will fix the first path but break the second one because it will extract 'com' as the format.

How do you use :format when your URI contains domain names?

I've hit this issue while upgrading from Rails 2.1.2 to Historically my site has just had two routes, one for the route with format and one without.