Sean Mountcastle
2005-Dec-30 14:13 UTC
Setting up Subdomains as Account Keys Under Mac OS X
I''m trying to configure my Rails app to use the subdomain as the account key. I''ve followed along with the HowTo [1], but under Mac OS X (10.4.3) I cannot get sub.domain.mine to map to 127.0.0.1. I''ve modified /etc/hosts as explained in "Dynamic Vhosts Working" [2], but I do not want to use Apache ... I''m using Webrick for development. Since this is Mac OS X, I also tried NetInfo Manager (/Applications/Utilities/NetInfo Manager.app) by duplicating machines localhost and changing the name property to "sub.domain.mine" -- but that still didn''t work. I also tried rebooting after maching the /etc/hosts and NetInfo changes, but that didn''t make it start to work. Is there something I''m missing to alias sub.domain.mine to 127.0.0.1? I wouldn''t think it would have anything to do with the webserver (Webrick) as the browser should be using the OS to resolve the domain name to an IP address. Many thanks in advance for assistance, Sean [1] http://wiki.rubyonrails.com/rails/pages/HowToUseSubdomainsAsAccountKeys [2] http://www.mpet45.co.uk/articles/2005/02/02
Toby Sterrett
2005-Dec-30 16:33 UTC
Re: Setting up Subdomains as Account Keys Under Mac OS X
On Dec 30, 2005, at 6:13 AM, Sean Mountcastle wrote:> I''m trying to configure my Rails app to use the subdomain as the > account key. I''ve followed along with the HowTo [1], but under Mac OS > X (10.4.3) I cannot get sub.domain.mine to map to 127.0.0.1.Make sure you still put the port number in the url, like sub.domain.mine:3000 toby
Sean Mountcastle
2005-Dec-30 17:37 UTC
Re: Setting up Subdomains as Account Keys Under Mac OS X
Toby,> Make sure you still put the port number in the url, like > sub.domain.mine:3000I was doing that. I finally figured out my problem, the directions in "Dynamic VHosts Working" [1] were incorrect for Mac OS X (and probably other Unix platforms). In /etc/hosts you cannot add multiple entries with the same key, like so: 127.0.0.1 localhost 127.0.0.1 sub.domain.mine 127.0.0.1 foo.domain.mine You must add the aliases on a single line: 127.0.0.1 localhost sub.domain.mine foo.domain.mine I also learned quite a bit about Mac OS X''s lookupd. If you type lookupd -configuration examine the host configuration item: LookupOrder: Cache FF NI DNS DS _config_name: Host Configuration You''ll want to ensure that FF appears before DNS so that the entries in your flat file (FF), /etc/hosts, are used before hitting the DNS servers. I''m going to update the Rails Wiki with this information. Regards, Sean [1] http://www.mpet45.co.uk/articles/2005/02/02