Localhost subdomains with Mongrel on OSX

I’m writing a rails app that will use subdomains ala basecamp and tadalist, so that users will be organized into groupname.foo.com. I’m kind of new to unix so I’m trying to figure out how to handle subdomains locally with mongrel. Obvioiusly going to somesubdomain.localhost:3000 doesn’t work. I’ve hacked the /etc/hosts file to setup a local test url: 127.0.0.1 www.localsite.com. I can use that to run locally and pick up subdomains but it feels like there has to be a better way. Any suggestions?

Also, in the etc/hosts file the * wildcard doesn’t seem to catch all subdomain s (ie. *.localsite.com)

Thanks

I'm sure there must be a better way on OSX but I don't know what it is. When I need to dev local apps that use subdomains I just setup some etc/hosts aliases and use those:

127.0.0.1 localhost.com engineyard.localhost.com ezmobius.localhost.com demo.localhost.com

cheers- -- Ezra Zygmuntowicz-- Lead Rails Evangelist -- ez@engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)

Agreed that I haven't found a way to do the * domains either -- what is nice on OSX, however is editing the /etc/hosts file and then running lookupd -flushcache to flush the dns cache so that it looks up (and finds your /etc/hosts file) everytime.

We wrote an article on cleanair about subdomain auth and how to test:

http://cleanair.highgroove.com/articles/2006/08/14/simplied-subdomain-authentication-in-ruby-on-rails

let us know if you find anything.