Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Problems: HTTPD2.2 virtual host proxying to a local Tomcat virtual host


Ok....so I've been tasked with configuring Apache 2.2 (httpd) and a servlet container (I'm going with Tomcat 6.0) to integrate together to allow httpd to act as a front end static server that will proxy dynamic requests to Tomcat.

The goal of this project is to enable Developer stations to be configured to support their own individual copy of each of the sites that they need to develop for. A lot of branding has been done to the sites that mean that brand1.com and brand2.com *can* share image, style, script files, etc but currently, the sites maintain separate copies of the same content. The sites will be refactored to identify global content but for now, assume that brand1.com's server maintains a copy of "foo.png" and brand2.com's server maintains its own copy of "foo.png"

For an individual developer station, I have Virtual Hosts configured in Apache like so
<VirtualHost 127.0.0.1>
DocumentRoot "C:/sites/brand1"
ServerName http://brand1.local

ProxyRequests On
ProxyPass /img/ http://dev-appserver/global/img
ProxyPass /webapp/ http://test.brand1.com/webapp/
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:/sites/brand2"
ServerName http://brand2.local

ProxyRequests On
ProxyPass /img http://dev-appserver/global/img
</VirtualHost>

Ok...so at this point, if someone has deployed the site to their local httpd server, and the home page contains global images, browsing to http://brand1.local will proxypass the image requests correctly. I also set it up so that the dynamic requests will be proxied

Now, I'm trying to get it to forward the dynamic requests and I'm a touch lost.
Let's say that brand1 has a products.jsp located within a folder called "dynamic"

I want to configure Tomcat 6 to act as a jsp container for all of the brand sites and have the HTTPD brand1.local virtual host proxy pass all jsp requests to the local Tomcat's brand1 virtual host.

Essentially, I want this behavior:
1) someone requests http://brand1.local/dynamic/products.jsp
2) C:\Windows\system32\drivers\etc\hosts file recognizes brand1.local as 127.0.0.1
3) call to brand1.local is directed to Apache
4) Apache identifies brand1.local as Virtual Host "brand1.local"
5) "brand1.local" vhost identifies that request is for "dynamic" folder and proxypasses to "http://brand1.local:8080/" (which is the local Tomcat server)
6) Tomcat's configuration identifies "brand1.local" and serves up dynamic/products.jsp from "{catalina.home}/webapps/sites/brand1/dynamic/products.jsp"

So where I am now:
- I have Apache configured with the appropriate virtualhost for brand1.local
- 127.0.0.1 brand1.local has been registered in the hosts file
- I have Tomcat running and brand1.local's server code running and directly assessible via "http://localhost:8080/sites/brand1/dynamic/products.jsp"
(I'll include a sidenote about this as a reply to my own post)
- I modified Tomcat's server.xml to include "brand1.local" as a virtualhost and pointed appBase to "/sites/brand1"

However, whenever I am redirected to "http://brand1.local:8080", which is the socket that my local Tomcat is running on, I receive nothing but a blank page.

Can anyone provide any insight?
View Original Thread
Comments
0
Be the first to comment

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect
avatar
Tags: tomcat, requests, sites, server
Tomcat 6 | Load Balancer IP configuration added as virtual host
Aug 12, 2010
Hi, I have an active-passive configuration of tomcat 6.0.18 running an ebxml based B2B gateway solution. The server is configured to run on port 8443 with a with a Cisco loadbalancer in front configured to NAT request received over 443 port (only…

Recommended way to setup Virtual Host
Jun 7, 2010
Hi, Can anyone tell me the recommended way to setup Virtual Host with one Physical IP on the server and multiple domains. ? Name Based Virtual Host Vs IP Based Virtual Host what is the best to choose/ Regards Nasir

nginx virtual host management
Jul 17, 2010
Are there recipes in puppet to deal with configuring nginx virtual host files? Ideally they'd be parameterized..

Setting Up Virtual Host Help Needed on WinXP
Jun 3, 2010
Howdy, I'm new to Apache web server. I have installed Apache 2.2.15 on my Windows development computer to become familiar with using it to run my web sites locally. The live production server will run them on a linux box under Apache, so I want…

still see .htaccess and .htpasswd trough virtual host
Jul 8, 2010
Hello list, I have become little confused and hope to get some help. I have a suse 11.2 server running Apache/2.2.10 (Linux/SUSE) with some virtual hosts. I already have the following in httpd.conf file `````````````` AccessFileName .htaccess …

users@httpd] virtual host failure on SUSE
May 24, 2010
I've had this problem before and fixed it but can't remember what the fix was :( I've got a couple of virtual sites on an SUSE server which I've just updated and now what was perfectly functional is not working. fbwiki.lsces.co.uk was showing …

Re: apr_dbd: Support for multiple database connections from the same virtual host
Jun 9, 2010
Topic up On Fri, May 21, 2010 at 1:07 AM, Marko Kevac <ma### @kevac.org> wrote: > Can someone comment on this, pls? > > On Mon, May 17, 2010 at 12:28 PM, Marko Kevac <ma### @kevac.org> wrote: >>…

Updated: (SLING-1513) allow host-specific rendering for virtual hosts. "Multitenancy Support"
Aug 13, 2010
[ https://issues.apache.org/jira/browse/SLING-1513?page=com.atlassian.ji ra.plugin.system.issuetabpanels:all-tabpanel ] Carsten Ziegeler updated SLING-1513:

svn commit: r964722 - in /tomcat/trunk/webapps: docs/changelog.xml host-manager/WEB-INF/web.xml host-manager/index.jsp manager/WEB-INF/web.xml manager
Jul 16, 2010
Author: markt Date: Fri Jul 16 09:09:44 2010 New Revision: 964722 URL: http://svn.apache.org/viewvc?rev=964722&view=rev Log: As suggested on the users list, add redirects to the HTML interface to the root of the host-manager and manager…

Tomcat 6.0 always uses default host in multi-host config
May 25, 2010
I have two IP-based virtual hosts configured in a standalone Tomcat server. Each host has its own SSL certificate and keystore. Tomcat appears to behave as if only the default host is defined. When I hit seconddomain.com, Tomcat serves the ROOT…