Author |
|
Andy Griffin
Joined: 01 May 2014 Posts: 3 Location: agriffin
|
Posted: Thu 01 May '14 17:31 Post subject: How to ajp redirect in Virtual Host |
|
|
Hi,
I have a server server.SERVER.com which ajp-redirects /app to port 8009 in httpd.conf as
Code: |
...
ProxyPass /app ajp://localhost:8009/app
|
and this redirects anything written as /app to port 8009 i.e.
http://server.SERVER.com/app is redirected to ajp://server.SERVER.com:8009/app
But then I wanted to add a virtual host test.SERVER.com that also redirects /app to ajp port 8006 so I added this in my httpd.conf
Code: |
<VirtualHost 192.168.1.2:80>
ServerName test.SERVER.com
DocumentRoot /var/www/html
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ProxyPass /app ajp://localhost:8006/app
</VirtualHost>
|
This doesn't redirect to 8006 because the setting above the virtual host is there. That is
http://test.SERVER.com/app is still redirecting to 8009 because the above setting is there. How can I make the setting inside the virtual host work to redirect to 8006 instead of 8009? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 02 May '14 11:26 Post subject: |
|
|
You may try
Code: |
<VirtualHost 192.168.1.2:80>
ServerName test.SERVER.com
DocumentRoot /var/www/html
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Location /app>
ProxyPass ajp://localhost:8006/app
ProxyPassReverse ajp://localhost:8006/app
</Location>
</VirtualHost>
|
|
|
Back to top |
|
Andy Griffin
Joined: 01 May 2014 Posts: 3 Location: agriffin
|
Posted: Fri 02 May '14 17:52 Post subject: |
|
|
Thanks for your reply.. but that gives me the same result. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 05 May '14 16:37 Post subject: |
|
|
Can't you put the other Reverseproxy stuff into a different vhost or also into an location?
Well another idea is to exclude the app path before defining the other ajp reverse proxy
ProxyPass /app !
ProxyPass / ...
... |
|
Back to top |
|
Andy Griffin
Joined: 01 May 2014 Posts: 3 Location: agriffin
|
Posted: Tue 06 May '14 18:59 Post subject: |
|
|
Tried putting the other Reverseproxy into <VirtualHost> and the ajp redirects in the virtualhost stopped working.
ProxyPass /app ! also gave the same result. |
|
Back to top |
|
Qmpeltaty
Joined: 06 Feb 2008 Posts: 182 Location: Poland
|
Posted: Fri 09 May '14 11:50 Post subject: |
|
|
What do you expect if the mounting /app is in the global configuration part ? It will apply for the whole Apache instance. You need to move it within the virtual host block. |
|
Back to top |
|
jraute
Joined: 13 Sep 2013 Posts: 188 Location: Rheinland, Germany
|
Posted: Wed 14 May '14 15:35 Post subject: |
|
|
What is the intention?
Load-balancing? |
|
Back to top |
|
chongster
Joined: 04 Jun 2014 Posts: 9
|
Posted: Wed 04 Jun '14 18:12 Post subject: |
|
|
You don't need ProxyPass when you are using DocumentRoot. If you are using ProxyPass to redirect to another servlet application then you should take out the DocumentRoot.
<VirtualHost 192.168.1.2:80>
ServerName test.SERVER.com
ProxyPass /app ajp://localhost:8006/app
</VirtualHost> |
|
Back to top |
|