From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.141.43.5 with SMTP id v5cs58546rvj; Mon, 8 Feb 2010 02:29:32 -0800 (PST) Received-SPF: pass (google.com: domain of 3iudvSwgJCi0SOcdLTNaPVJRU.LXVaJLT-MNeNUPXXPUNPaXdYb.LXV@groups.bounces.google.com designates 10.101.137.22 as permitted sender) client-ip=10.101.137.22; Authentication-Results: mr.google.com; spf=pass (google.com: domain of 3iudvSwgJCi0SOcdLTNaPVJRU.LXVaJLT-MNeNUPXXPUNPaXdYb.LXV@groups.bounces.google.com designates 10.101.137.22 as permitted sender) smtp.mail=3iudvSwgJCi0SOcdLTNaPVJRU.LXVaJLT-MNeNUPXXPUNPaXdYb.LXV@groups.bounces.google.com; dkim=pass header.i=3iudvSwgJCi0SOcdLTNaPVJRU.LXVaJLT-MNeNUPXXPUNPaXdYb.LXV@groups.bounces.google.com Received: from mr.google.com ([10.101.137.22]) by 10.101.137.22 with SMTP id p22mr6407311ann.5.1265624971677 (num_hops = 1); Mon, 08 Feb 2010 02:29:31 -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:received:received:mime-version :subject:from:in-reply-to:date:message-id:references:to:x-mailer :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:content-transfer-encoding; bh=7d32JKh9o1IC1Ck3+T/+bkquD4EwAh2SjC9wUwiTjeE=; b=GVjnyRenYoFjjD5Rrfi1oKZJbrWOpU7vekCVhalYQD6HQMjRo1rAR6dsV1VAoBrxLj kxEEmvyF1W86/O0KzroggZGrg7rndbgxJrnvlw5qqGUbmxrTruHES8nl902u1rr4o5pK UhuugclotJ5S/0naSQb9oFYUXDHxw/xCaQ36Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:subject:from:in-reply-to:date :message-id:references:to:x-mailer: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 :content-transfer-encoding; b=Y8KP+uT6FS6tGwEqs72bp6c0uJrP3EX8GhnplAKnWnk0To1srwnW03AJFQgHFRlQRk S0AXh7ZbYFtipDn9MeAlKsWmmpD2e46gPAHnnyAj+aQn7yvSdB7CCDYP58UZi0yH2FsP kQT0ahGSLZ+HN4ka1HHPaUuDY+dvAFKoE857g= Received: by 10.101.137.22 with SMTP id p22mr534769ann.5.1265624970422; Mon, 08 Feb 2010 02:29:30 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.213.44.133 with SMTP id a5ls905618ebf.1.p; Mon, 08 Feb 2010 02:29:28 -0800 (PST) Received: by 10.213.97.74 with SMTP id k10mr346964ebn.8.1265624968204; Mon, 08 Feb 2010 02:29:28 -0800 (PST) Received: by 10.213.97.74 with SMTP id k10mr346963ebn.8.1265624968180; Mon, 08 Feb 2010 02:29:28 -0800 (PST) Return-Path: Received: from mail-ew0-f219.google.com (mail-ew0-f219.google.com [209.85.219.219]) by gmr-mx.google.com with ESMTP id 18si449664ewy.0.2010.02.08.02.29.27; Mon, 08 Feb 2010 02:29:27 -0800 (PST) Received-SPF: pass (google.com: domain of jftucker@gmail.com designates 209.85.219.219 as permitted sender) client-ip=209.85.219.219; Received: by ewy19 with SMTP id 19so5741549ewy.1 for ; Mon, 08 Feb 2010 02:29:27 -0800 (PST) Received: by 10.216.88.10 with SMTP id z10mr1169036wee.108.1265624966869; Mon, 08 Feb 2010 02:29:26 -0800 (PST) Return-Path: Received: from ?192.168.1.101? (bb-87-81-237-21.ukonline.co.uk [87.81.237.21]) by mx.google.com with ESMTPS id i6sm10786830gve.16.2010.02.08.02.29.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 08 Feb 2010 02:29:25 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: Middleware to dispatch request to multiple applications based on request domain name From: James Tucker In-Reply-To: <09592190-728b-44a0-82ac-dda461bbc39e@z41g2000yqz.googlegroups.com> Date: Mon, 8 Feb 2010 10:29:23 +0000 Message-Id: <7D02B231-F5B0-4993-96B0-203882FC44AC@gmail.com> References: <09F3BCD8-6945-4DCC-BA70-A7F1777DC09C@gmail.com> <09592190-728b-44a0-82ac-dda461bbc39e@z41g2000yqz.googlegroups.com> To: rack-devel@googlegroups.com X-Mailer: Apple Mail (2.1077) X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jftucker@gmail.com designates 209.85.219.219 as permitted sender) smtp.mail=jftucker@gmail.com; dkim=pass (test mode) header.i=@gmail.com X-Original-Sender: jftucker@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/3e17b043166d2b81 Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable On 7 Feb 2010, at 22:36, misza222 wrote: > On 7 Feb, 11:57, James Tucker wrote: >> On 6 Feb 2010, at 16:58, misza222 wrote: >>=20 >>> Hi, >>=20 >>> 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? >>=20 >> map "http://mydomain.com/" do >> run App1.new >> end >>=20 >> map "http://otherdomain.com/" do >> run App2.new >> end >>=20 >>=20 >>=20 >>> Cheers, >>=20 >>> Michal >>=20 >>=20 >=20 > Thanks James. >=20 > Where is 'map' method defined as I can't find it in the code? Rack::Builder in lib/rack/builder.rb > And is there any way to make one of those apps a default one so it can > catch all unmatched paths? Yes, don't use a host for that app, and map to / >=20 > -- > Cheers, >=20 > Michal