Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 47672 invoked from network); 21 Mar 2008 00:32:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Mar 2008 00:32:38 -0000 Received: (qmail 60823 invoked by uid 500); 21 Mar 2008 00:32:26 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 60804 invoked by uid 500); 21 Mar 2008 00:32:26 -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 60793 invoked by uid 99); 21 Mar 2008 00:32:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 17:32:26 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=NORMAL_HTTP_TO_IP,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [38.99.14.75] (HELO owa.clearwellsystems.com) (38.99.14.75) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Mar 2008 00:31:38 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Thu, 20 Mar 2008 17:31:57 -0700 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [users@httpd] Apache reverse-proxy config. Thread-Index: AciKXh3KbOp+nc/rTSa5ooSs449R1AAiitxg From: "Venkat Rangan" To: X-Virus-Checked: Checked by ClamAV on apache.org Subject: RE: [users@httpd] Apache reverse-proxy config. Nils, Thanks very much for your help. I have made some progress - but still do not have a solution. My snippet from httpd.conf on the Proxy Server (192.168.121.214) is: NameVirtualHost 192.168.121.214:8080 ServerName test1 ProxyPreserveHost On ProxyPass /testcase1/app http://192.168.122.184/app ProxyPassReverse /testcase1/app http://192.168.122.184/app ProxyHTMLURLMap http://192.168.122.184/app /testcase1/app ProxyPass /testcase2/app http://192.168.122.247/app ProxyPassReverse /testcase2/app http://192.168.122.247/app ProxyHTMLURLMap http://192.168.122.247/app /testcase2/app ErrorLog c:/temp/test-error.log My goal is the following: Browser sends requests to the following to the proxy. (I have my DNS set to resolve test1 to 192.168.121.214) Request-1: http://test1:8080/testcase1/app Request-2: http://test1:8080/testcase2/app I want the Proxy Server (192.168.121.214:8080) to route: Request-1 to: http://192.168.122.184/app Request-2 to: http://192.168.122.247/app It doesn't work - produces a 404 Not Found error and the Proxy Server has the following in its access.log. 192.168.12.127 - - [20/Mar/2008:16:00:28 -0700] "GET /testcase1/app HTTP/1.0" 302 - 192.168.12.127 - - [20/Mar/2008:16:00:28 -0700] "GET /app/ HTTP/1.0" 404 202 192.168.12.127 - - [20/Mar/2008:16:15:31 -0700] "GET /testcase2/app HTTP/1.0" 302 - 192.168.12.127 - - [20/Mar/2008:16:15:31 -0700] "GET /app/ HTTP/1.0" 404 202 On the other hand, if I create two separate VirtualHosts such as the following. NameVirtualHost 192.168.121.214:8080 ServerName test1 ProxyPreserveHost On ProxyPass /app http://192.168.122.184/app ProxyPassReverse /app http://192.168.122.184/app ProxyHTMLURLMap http://192.168.122.184/app /app ErrorLog c:/temp/test1-error.log ServerName test2 ProxyPreserveHost On ProxyPass /app http://192.168.122.247/app ProxyPassReverse /app http://192.168.122.247/app ProxyHTMLURLMap http://192.168.122.247/app /app ErrorLog c:/temp/test2-error.log Now, if I have DNS resolve both test1 and test2 to the same Proxy IP Address (192.168.121.214), and issue http://test1:8080/app, or http://test2:8080/app, everything works fine and the requests go to the right Origin Servers. For success case, the Access Log has: 192.168.12.127 - - [20/Mar/2008:12:58:15 -0700] "GET /app HTTP/1.1" 302 - 192.168.12.127 - - [20/Mar/2008:12:58:15 -0700] "GET /app/goToUserHome.do HTTP/1.1" 200 36175 Note that there is an additional JavaScript, in the response from the Origin Server in both cases - 'wget http://192.168.122.184/app' on the proxy produces the following HTML. Go To Home Page   For some reason, when I have two VirtualHosts, the JavaScript is properly recognized and re-issued by the Proxy. If I have one VirtualHost with two separate path-based ProxyPass, the above GET doesn't happen. Is there something I am missing in the Proxy httpd.config? Do I need some kind of a re-write rule? Thanks. -----Original Message----- From: Nils Jeppe [mailto:nils@pandemonium.de]=20 Sent: Thursday, March 20, 2008 12:46 AM To: users@httpd.apache.org Subject: Re: [users@httpd] Apache reverse-proxy config. On Wed, 19 Mar 2008, Venkat Rangan wrote: > Is there anything I am missing? Yes. Apache is not able to distinguish between your two virtualhosts, and=20 thus using the first one. Use NameVirtualHost on the IP (or *) in the main=20 part of your config and assign ServerName 's to each of the virtualhosts.=20 I think this should solve your problem. Best wishes, Nils --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org