Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0335CC4E3 for ; Thu, 3 May 2012 22:56:27 +0000 (UTC) Received: (qmail 21154 invoked by uid 500); 3 May 2012 22:56:26 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 21101 invoked by uid 500); 3 May 2012 22:56:26 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 21093 invoked by uid 99); 3 May 2012 22:56:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 May 2012 22:56:26 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [64.59.134.12] (HELO smtp-out-04.shaw.ca) (64.59.134.12) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 May 2012 22:56:18 +0000 Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd6ml3no-ssvc.prod.shaw.ca) ([10.0.144.222]) by pd5mo1no-svcs.prod.shaw.ca with ESMTP; 03 May 2012 16:55:56 -0600 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=gFGh1ScE7ROJHT2jhivHYaSHya8441O0LZB7wkhlVyo= c=1 sm=1 a=kiG6hdqEmeoA:10 a=0Gs-4lMAab8A:10 a=2pqqzDx6IZcA:10 a=BLceEmwcHowA:10 a=8nJEP1OIZ-IA:10 a=lXLi4ALwq7S/fiCwzvVz7Q==:17 a=mV9VRH-2AAAA:8 a=9rJKEg7jk8AEs4BWP6YA:9 a=qM6INaOgffxkNXJCIEcA:7 a=wPNLvfGTeEIA:10 a=6Eom868HBxbIbWhR:21 a=3nDOQ59kaCVbAhs4:21 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO [192.168.0.106]) ([96.54.200.168]) by pd6ml3no-dmz.prod.shaw.ca with ESMTP; 03 May 2012 16:55:56 -0600 Message-ID: <4FA30D5A.3040406@pearsoncmg.com> Date: Thu, 03 May 2012 15:57:30 -0700 From: Chris Darroch Organization: Pearson CMG/LTG User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.24) Gecko/20100319 SeaMonkey/1.1.19 MIME-Version: 1.0 To: dev@httpd.apache.org Subject: using X-Forwarded-Host as r->hostname X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi -- It's been a remarkably long time since I had anything useful to commit, and I'm pretty rusty, so I thought I'd throw this out for discussion as a RTC despite the CTR rules on trunk. I promise I won't be offended if anyone says it's a stupid hack and should never be committed, because, well, it is arguably a very stupid hack. I've been fighting a context where I have a new server behind an ancient internal proxy for some transitional period of time until we can replace the proxy too. The proxy won't send Host headers (in httpd terms, no equivalent to ProxyPreserveHost On functionality), but it does put the originally requested Host header into X-Forwarded-Host. On the backend, try as I might, I could not find a way to map the X-Forwarded-Host header on top of the Host one prior to the point where the appropriate is determined. I hoped for some combo of mod_headers in "early" mode + mod_setenvif, but they run in post_read_request in the opposite order from what I needed. Hence this patch, which adds a UseCanonicalName XHost option in which X-Forwarded-Host is checked first, and if non-blank, is used in place of Host to determine the server name. (The Host header is left as-is, though.) http://people.apache.org/~chrisd/patches/use_canonical_name_xhost/use_canonical_name_xhost-trunk.patch Even if there's a resounding chorus of "boos", perhaps posting it here will help others facing the same problem in the future find a bit of a workaround if they're stuck in the same situation. Let the torches and firebrands be set alight! Cheers, Chris. -- GPG Key ID: 088335A9 GPG Key Fingerprint: 86CD 3297 7493 75BC F820 6715 F54F E648 0883 35A9