logoon  windows
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Forum Register Log in  RSS Apache Lounge


Keep Server Online

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

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

Thank You! Steffen

Apache Lounge is not sponsored by anyone.

Your donations will help to keep this site alive and well, and continuing the building of the binaries.




Chain 2 virtual hosts using ProxyPass and ProxyPassReverse

 
Post new topic   Reply to topic    Apache Forum Index -> Apache



View previous topic :: View next topic  
Author Message
jnsunkersett



Joined: 30 Jan 2011
Posts: 23

PostPosted: Tue 20 Mar '12 19:52    Post subject: Chain 2 virtual hosts using ProxyPass and ProxyPassReverse Reply with quote

Hi,

Is is possible to chain 2 virtual hosts using ProxyPass and ProxyPassReverse directives?
I want to direct traffic based on URI - the user should not be required to know the port number of the VH.

To elaborate;

I have an Apache server httpd, ver 2.2.17 in which I have defined 2 virtual host.

<VirtualHost *:80>
JkMount /* loadBalancer-R1
</VirtualHost>

<VirtualHost *:90>
JkMount /* loadBalancer-R2
</VirtualHost>

Then using mod_jk + ajp13 + worker.properties, established a Apache front end for 2 instances of my Tomcat server.

loadBalancer-R1, routes requests to Tomcat-instance-1
loadBalancer-R2, routes requests to Tomcat-instance-2

But for that in the browser I need to type

http://serverName:PORT/uri .... port 80 is picked by default but if it is port 90, I need to explicitly specify it.

I would like to use only the default port and have a URI, like /relaease2 instead,

where http://serverName/release2 takes user to http://serverName:90/uri

and

where http://serverName/release1 takes user to http://serverName:80/uri

I tried to use ProxyPass and ProxyPassReverse directives but did not succeed in redirecting traffic as per the URI.

Your clues/ workarounds, will be greatly appreciated.

thank you.
Jeevan

PS: I was referring to James reply when trying ProxyPass and ProxyPassReverse
http://www.apachelounge.com/viewtopic.php?t=4455&highlight=
Back to top
James Blond
Moderator


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

PostPosted: Wed 21 Mar '12 15:04    Post subject: Re: Chain 2 virtual hosts using ProxyPass and ProxyPassRever Reply with quote

jnsunkersett wrote:


I would like to use only the default port and have a URI, like /relaease2 instead,

where http://serverName/release2 takes user to http://serverName:90/uri

and

where http://serverName/release1 takes user to http://serverName:80/uri


Why not using a single vhost on port 80 and out your mod jk stuff into a Location container? I've done that with the on board proxy stuff.

I've not mod_jk, but my setup would be something like
Code:

VirtualHost *:80>
   ServerName localhost
   DocumentRoot "/Apache23/htdocs"
   <Directory "/Apache23/htdocs">
      Options Indexes FollowSymLinks Includes
      AllowOverride None
      Order Allow,Deny
      Allow from All
   </Directory>
   <Location /release1>
      JkMount /* loadBalancer-R1
   </Location>
   <Location /release2>
      JkMount /* loadBalancer-R2
   </Location>
</VirtualHost>


Since I don't have mod jk, but some jenkins I use the mod_proxy_ajp stuff. That would be:
Code:

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot "/Apache23/htdocs"
   <Directory "/Apache23/htdocs">
      Options Indexes FollowSymLinks Includes
      AllowOverride None
      Order Allow,Deny
      Allow from All
   </Directory>
   <Location /release1>
      ProxyPass balancer://hotcluster1/
      <Proxy balancer://hotcluster1>
      BalancerMember ajp://1.2.3.4:8009 loadfactor=1
      BalancerMember ajp://1.2.3.5:8009 loadfactor=2
      # The below is the hot standby
      BalancerMember ajp://1.2.3.6:8009 status=+H
      ProxySet lbmethod=bytraffic
      </Proxy>
   </Location>
   <Location /release2>
      ProxyPass balancer://hotcluster2/
      <Proxy balancer://hotcluster2>
      BalancerMember ajp://1.2.3.4:8099 loadfactor=1
      BalancerMember ajp://1.2.3.5:8099 loadfactor=2
      # The below is the hot standby
      BalancerMember ajp://1.2.3.6:8099 status=+H
      ProxySet lbmethod=bytraffic
      </Proxy>
   </Location>
</VirtualHost>
Back to top


Post new topic   Reply to topic    Apache Forum Index -> Apache
Page 1 of 1