Hi, Is it possible to use subdomains under one Rails application? I''m building a retail app that requires a secure checkout. The requirements are to have the shop front under http://www.mydomain.com and to move to https://checkout.mydomain.com when the user proceeds to the checkout. This will eventually end up being deployed on IIS. Is it possible to deal with the subdomains using Rails'' routing? Thanks for your help, Matt
On 8/2/05, Matt <listaction-FXsoPwVLZSKdyyGsB3R/UQ@public.gmane.org> wrote:> Hi, > > Is it possible to use subdomains under one Rails application? > > I''m building a retail app that requires a secure checkout. The > requirements are to have the shop front under http://www.mydomain.com > and to move to https://checkout.mydomain.com when the user proceeds > to the checkout. > > This will eventually end up being deployed on IIS. > > Is it possible to deal with the subdomains using Rails'' routing? > > Thanks for your help, > > MattThe rails app doesn''t really care what hostname it gets. You just have to be sure to map both hostnames to it in IIS, and you should be okay. You can check if you''re at checkout with: request.subdomains.first == ''checkout'' -- rick http://techno-weenie.net
> Is it possible to deal with the subdomains using Rails'' routing?AFAIK Routes has no specific support for subdomains, but this doesn''t hurt you much. You can do the work with before_filters (check if you are on the right domain and protocol for the Checkout-Controller for example) although it would be a bit easier with explicit support in Routes. Cookie-params have to be set explicitely to allow sharing the session with both subdomains: ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:session_domain => ''x.com'') # (excerpt from an email from Rick Olson) Michael
Thanks guys, that helps a lot. Matt On 2 Aug 2005, at 14:31, Michael Raidel wrote:>> Is it possible to deal with the subdomains using Rails'' routing? >> > > AFAIK Routes has no specific support for subdomains, but this doesn''t > hurt you much. You can do the work with before_filters (check if you > are on the right domain and protocol for the Checkout-Controller for > example) although it would be a bit easier with explicit support in > Routes. > > Cookie-params have to be set explicitely to allow sharing the session > with both subdomains: > ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update > (:session_domain > => ''x.com'') # (excerpt from an email from Rick Olson) > > Michael > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >