From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.141.43.5 with SMTP id v5cs22003rvj; Sun, 7 Feb 2010 14:54:45 -0800 (PST) Received-SPF: pass (google.com: domain of 3rURvSwcJCqwTMe.eajSYMUX.OaYdMOW-PQhQXSaaSXQSdagbe.OaY@groups.bounces.google.com designates 10.115.101.27 as permitted sender) client-ip=10.115.101.27; Authentication-Results: mr.google.com; spf=pass (google.com: domain of 3rURvSwcJCqwTMe.eajSYMUX.OaYdMOW-PQhQXSaaSXQSdagbe.OaY@groups.bounces.google.com designates 10.115.101.27 as permitted sender) smtp.mail=3rURvSwcJCqwTMe.eajSYMUX.OaYdMOW-PQhQXSaaSXQSdagbe.OaY@groups.bounces.google.com; dkim=pass header.i=3rURvSwcJCqwTMe.eajSYMUX.OaYdMOW-PQhQXSaaSXQSdagbe.OaY@groups.bounces.google.com Received: from mr.google.com ([10.115.101.27]) by 10.115.101.27 with SMTP id d27mr2102643wam.5.1265583278455 (num_hops = 1); Sun, 07 Feb 2010 14:54:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:received:mime-version:received:in-reply-to :references:date:message-id:subject:from:to :x-original-authentication-results:x-original-sender:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :x-thread-url:x-message-url:sender:list-subscribe:list-unsubscribe :content-type; bh=OWHNElOn+FIHeYLvqZe4MzcFxH3bVktRrKwQX20vDGs=; b=CIcvj3XO3RPmqfvqtJqP55F8XRjr9XdPJU3GQR9A0rmEkntOXqzA/5+f+7AqbRdUET hqztoxi9llD61WK/vdLoKICRq1fwhIeXFO+IHXqt9YgUVF7no0sobqirkpBhgoUFnxX+ Y142jYDexfktMnEi4tv6SFr2qiP1N1kz2HneI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:in-reply-to:references:date :message-id:subject:from:to:x-original-authentication-results :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:x-thread-url:x-message-url:sender :list-subscribe:list-unsubscribe:content-type; b=YWt6LTIsNfwu8ZWq3Fgg13Uaalbk/hLbYVTV5ORcZ/2JciEYUzzCT1RVNpfMw2B28K qwwWh7nejaBtWTUz2se0VdFpLwHhOts6Klxzva3PLBZIXeYAABMKVyLXZzMJnnyq/c3L MPA0Te3pIL1wDvZ7uWcF261c5/tseve9w9icc= Received: by 10.115.101.27 with SMTP id d27mr303373wam.5.1265583277222; Sun, 07 Feb 2010 14:54:37 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.114.215.3 with SMTP id n3ls682846wag.2.p; Sun, 07 Feb 2010 14:54:35 -0800 (PST) Received: by 10.114.2.11 with SMTP id 11mr1099519wab.6.1265583275286; Sun, 07 Feb 2010 14:54:35 -0800 (PST) Received: by 10.114.2.11 with SMTP id 11mr1099518wab.6.1265583275258; Sun, 07 Feb 2010 14:54:35 -0800 (PST) Return-Path: Received: from mail-px0-f188.google.com (mail-px0-f188.google.com [209.85.216.188]) by gmr-mx.google.com with ESMTP id 16si932502pxi.5.2010.02.07.14.54.34; Sun, 07 Feb 2010 14:54:34 -0800 (PST) Received-SPF: pass (google.com: domain of has.sox@gmail.com designates 209.85.216.188 as permitted sender) client-ip=209.85.216.188; Received: by pxi26 with SMTP id 26so6705880pxi.17 for ; Sun, 07 Feb 2010 14:54:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.61.25 with SMTP id j25mr3708455wfa.304.1265583274015; Sun, 07 Feb 2010 14:54:34 -0800 (PST) In-Reply-To: <09592190-728b-44a0-82ac-dda461bbc39e@z41g2000yqz.googlegroups.com> References: <09F3BCD8-6945-4DCC-BA70-A7F1777DC09C@gmail.com> <09592190-728b-44a0-82ac-dda461bbc39e@z41g2000yqz.googlegroups.com> Date: Mon, 8 Feb 2010 09:54:33 +1100 Message-ID: <2fff50391002071454y1f153b72tece6a1040140ebc8@mail.gmail.com> Subject: Re: Middleware to dispatch request to multiple applications based on request domain name From: Daniel N To: rack-devel@googlegroups.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of has.sox@gmail.com designates 209.85.216.188 as permitted sender) smtp.mail=has.sox@gmail.com; dkim=pass (test mode) header.i=@gmail.com X-Original-Sender: has.sox@gmail.com Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: X-Thread-Url: http://groups.google.com/group/rack-devel/t/82553516626086d8 X-Message-Url: http://groups.google.com/group/rack-devel/msg/8527012a639ab1c3 Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: multipart/alternative; boundary=001636e0b6047b4100047f0a912f --001636e0b6047b4100047f0a912f Content-Type: text/plain; charset=ISO-8859-1 Hi, Usher or Rack::Mount which are rack based routers should be able to handle this easily. Cheers Daniel On Mon, Feb 8, 2010 at 9:36 AM, misza222 wrote: > On 7 Feb, 11:57, James Tucker wrote: > > On 6 Feb 2010, at 16:58, misza222 wrote: > > > > > Hi, > > > > > Here is a problem I have. > > > There is an app which consists of multiple subapps. Requests needs to > > > be dispatched to the particular subapp based on the domain name. > > > I thought Rack::URLMap may be a solution but couldn't make it to work > > > so eventually I created my own rack middleware that allowed me to > > > achieve it. Here is how it looks likehttp:// > github.com/misza222/dispatch_by_domain > > > But am I reinventing a wheel here? Is there any way to achieve the > > > same thing with existing rack middleware? > > > > map "http://mydomain.com/" do > > run App1.new > > end > > > > map "http://otherdomain.com/" do > > run App2.new > > end > > > > > > > > > Cheers, > > > > > Michal > > > > > > Thanks James. > > Where is 'map' method defined as I can't find it in the code? > And is there any way to make one of those apps a default one so it can > catch all unmatched paths? > > -- > Cheers, > > Michal > --001636e0b6047b4100047f0a912f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

Usher or Rack::Mount which are rack based routers sh= ould be able to handle this easily.

Cheers
Daniel


On Mon, Feb 8, 2010 = at 9:36 AM, misza222 <misza222@gmail.com> wrote:
On 7 Feb, 11:57, James Tu= cker <jftuc...@gmail.com> w= rote:
> On 6 Feb 2010, at 16:58, misza222 wrote:
>
> > Hi,
>
> > Here is a problem I have.
> > There is an app which consists of multiple subapps. Requests need= s to
> > be dispatched to the particular subapp based on the domain name.<= br> > > I thought Rack::URLMap may be a solution but couldn't make it= to work
> > so eventually I created my own rack middleware that allowed me to=
> > achieve it. Here is how it looks likehttp://github.com/mis= za222/dispatch_by_domain
> > But am I reinventing a wheel here? Is there any= way to achieve the
> > same thing with existing rack middleware?
>
> map "http://my= domain.com/" do
> =A0 run App1.new
> end
>
> map "http:/= /otherdomain.com/" do
> =A0 run App2.new
> end
>
>
>
> > Cheers,
>
> > Michal
>
>

Thanks James.

Where is 'map' method defined as I can't find it in the code? And is there any way to make one of those apps a default one so it can
catch all unmatched paths?

--
Cheers,

Michal

--001636e0b6047b4100047f0a912f--