Return-Path: X-Original-To: apmail-httpd-users-archive@www.apache.org Delivered-To: apmail-httpd-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 747FC991E for ; Thu, 15 Mar 2012 14:25:24 +0000 (UTC) Received: (qmail 10064 invoked by uid 500); 15 Mar 2012 14:25:21 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 9994 invoked by uid 500); 15 Mar 2012 14:25:20 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 9979 invoked by uid 99); 15 Mar 2012 14:25:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2012 14:25:20 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of brett.maxfield@gmail.com designates 74.125.83.45 as permitted sender) Received: from [74.125.83.45] (HELO mail-ee0-f45.google.com) (74.125.83.45) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2012 14:25:12 +0000 Received: by eeit10 with SMTP id t10so2245449eei.18 for ; Thu, 15 Mar 2012 07:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=D++tBgttzsRz1spUOlAvUk5I/p3I21VnZUVudDja8dM=; b=idF8fvTycWzTGKDWKZ+xR4rN6GtKn4PZCfzYCx1sBCDD55RGtFP4AnykK8Luynl2si tG8QHNkYsTmjG+XgyJK2buhRjW6TtlsQTpYxrguXPY6h7IOOiBH+MowidPVVECu/Cxtq fMofI42SZSRoAwJFSyJ0c23qM58kgjwQQGHbNfwEla6hjoVLty4OkBOrlw7v8QpHc0PP Wx9RXLEDkBneRCjr1rvuC2nkkR+ckOapHcFMRLCVtaxrRGeovXv2JUi/NwyCexNxIbyj agwfke7ZxzotZ92gYvYy9ji+9sCkPhnkbXGclb4Qfi3vOKGfhgKWnyRnwDRlj232M7DE x6rA== MIME-Version: 1.0 Received: by 10.14.194.72 with SMTP id l48mr974593een.100.1331821491715; Thu, 15 Mar 2012 07:24:51 -0700 (PDT) Received: by 10.213.112.140 with HTTP; Thu, 15 Mar 2012 07:24:51 -0700 (PDT) In-Reply-To: References: Date: Fri, 16 Mar 2012 00:24:51 +1000 Message-ID: From: "Brett @Google" To: users@httpd.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [users@httpd] apache 2.4 virtualhosts Is order significant ? In your example it checks in the virtual hosts matching ip:port in config file order : 1. ServerName www.example.com 2. ServerName gone.example.com 3. ServerName forbidden.example.com ServerAlias *.example.com The wildcard is last in your example, in mine it is first. Is it as simple as changing the order so more specific non-wildcard servernames match first and the wildcard last ? Bummer :) If so, the example at http://httpd.apache.org/docs/2.4/vhosts/name-based.html says : # This first-listed virtual host is also the default for *:80 ServerName www.example.com ServerAlias example.com *.example.com DocumentRoot /www/domain ServerName other.example.com DocumentRoot /www/otherdomain It should probably say : ServerName other.example.com DocumentRoot /www/otherdomain # This first-listed virtual host is also the default for *:80 ServerName www.example.com ServerAlias example.com *.example.com DocumentRoot /www/domain That makes sense to me, if it is true.. if not i'll ponder it awhile and post some specific 2.2 and 2.4 configs tomorrow. I appreciate your help :) Cheers Brett On Thu, Mar 15, 2012 at 11:56 PM, Eric Covener wrote: >> I'm guessing that apache 2.4 does not search for more specific >> ServerName if it matches a wildcard ServerAlias ? > > Not sure I'm following what's behaving different. =A0Can you simplify > your example/claim in both releases? > > I couldn't get an unexpected result: > > > ServerName www.example.com > > > ServerName gone.example.com > RewriteEngine on > RewriteRule .* - [G] > > > ServerName forbidden.example.com > ServerAlias *.example.com > RewriteEngine on > RewriteRule .* - [F] > > > covener@cov-t61p:~/SRC/httpd-2.4.x$ printf "GET / HTTP/1.1\r\nHost: > forbidden.example.com\r\n\r\n" | nc 0 80 > HTTP/1.1 403 Forbidden > Date: Thu, 15 Mar 2012 13:54:10 GMT > Server: Apache/2.4.2-dev (Unix) OpenSSL/1.0.0e > Content-Length: 202 > Content-Type: text/html; charset=3Diso-8859-1 > > > > 403 Forbidden > >

Forbidden

>

You don't have permission to access / > on this server.

> > covener@cov-t61p:~/SRC/httpd-2.4.x$ printf "GET / HTTP/1.1\r\nHost: > gone.example.com\r\n\r\n" | nc 0 80 > HTTP/1.1 410 Gone > Date: Thu, 15 Mar 2012 13:54:13 GMT > Server: Apache/2.4.2-dev (Unix) OpenSSL/1.0.0e > Content-Length: 295 > Content-Type: text/html; charset=3Diso-8859-1 > > > > 410 Gone > >

Gone

>

The requested resource
/
> is no longer available on this server and there is no forwarding address. > Please remove all references to this resource.

> > covener@cov-t61p:~/SRC/httpd-2.4.x$ printf "GET / HTTP/1.1\r\nHost: > foo.example.com\r\n\r\n" | nc 0 80 > HTTP/1.1 403 Forbidden > Date: Thu, 15 Mar 2012 13:54:18 GMT > Server: Apache/2.4.2-dev (Unix) OpenSSL/1.0.0e > Content-Length: 202 > Content-Type: text/html; charset=3Diso-8859-1 > > > > 403 Forbidden > > >

Forbidden

>

You don't have permission to access / > on this server.

> > > covener@cov-t61p:~/SRC/httpd-2.4.x$ printf "GET / HTTP/1.1\r\nHost: > www.example.com\r\n\r\n" | nc 0 80 > HTTP/1.1 200 OK > Date: Thu, 15 Mar 2012 13:55:22 GMT > Server: Apache/2.4.2-dev (Unix) OpenSSL/1.0.0e > Last-Modified: Fri, 11 Nov 2011 17:43:44 GMT > ETag: "2d-4b1790ff95400" > Accept-Ranges: bytes > Content-Length: 45 > Content-Type: text/html > >

It works!

> > > covener@cov-t61p:~/SRC/httpd-2.4.x$ printf "GET / HTTP/1.1\r\nHost: > bar.com\r\n\r\n" | nc 0 80 > HTTP/1.1 200 OK > Date: Thu, 15 Mar 2012 13:56:06 GMT > Server: Apache/2.4.2-dev (Unix) OpenSSL/1.0.0e > Last-Modified: Fri, 11 Nov 2011 17:43:44 GMT > ETag: "2d-4b1790ff95400" > Accept-Ranges: bytes > Content-Length: 45 > Content-Type: text/html > >

It works!

> > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org > For additional commands, e-mail: users-help@httpd.apache.org > --=20 The only thing that interferes with my learning is my education. Albert Einstein --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org