logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Problems with ProxyPreseveHost On using Apache 2.2,mod_proxy
Author
awebpro



Joined: 29 Aug 2007
Posts: 2

PostPosted: Fri 31 Aug '07 22:50    Post subject: Problems with ProxyPreseveHost On using Apache 2.2,mod_proxy Reply with quote

Environment:I have Apache 2.2 with Tomcat 6 running. I also have a virtual host. I am trying to connect the two together. Mod_jk would not work so I am trying the mod_proxy approach. This has been giving me a problem that I have not been able to figure out for a few days now. I'd appreciate it if someone could solve it for me. Thanks in advance.

So, when I type in www.example.com at my browser window, it points to the static content. Good so far. I use mod_proxy and it redirects www.example.com to http://localhost:8080/myExample/index.jsp which is a java app running on Tomcat6. Again, good so far. But I don't want someone typing in my url and being shown the localhost url. So, I do ProxyPreserveHost On. Here is where the problem is. My address bar shows it trying to connect to http://www.myexample.com/myExample/index.jsp and FAILS. If I turn ProxyPreserveHost back to Off, it works! But now you can see the localhost url which no one needs to see.

Here is my httpd-vhosts file. *************************************************************
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

<Directory C:/vhosts>
Order Deny,Allow
Allow from all
</Directory>


#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot c:/vhosts
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot C:/vhosts/myexample
ServerName www.myexample.com

ProxyRequests Off
ProxyPreserveHost On
DirectoryIndex index.jsp

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / http://localhost:8080/myExample/
ProxyPassReverse / http://localhost:8080/myExample/


</VirtualHost>

**********************************************************

Here is my httpd file. It's the standard file. i just wanted to show you the LoadModules sections to see if i have them correctly listed.


**********************************************************
#
# This is the main Apache HTTP server configuration file. It contains the
ADMIN NOTE: trimmed full httpd.conf listing.
Please see the Forum Rules
...

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
...
***********************************************************

WHAT AM I MISSING???
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 04 Sep '07 12:45    Post subject: Reply with quote

For connecting to jsp pages you should use the ajp connector

Code:

 ProxySet ajp://localhost:8080/ timeout=15


For more info use the forum search. There are a lot of topics about that or use the docs

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
Back to top


Reply to topic   Topic: Problems with ProxyPreseveHost On using Apache 2.2,mod_proxy View previous topic :: View next topic
Post new topic   Forum Index -> Apache