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: How to ajp redirect in Virtual Host
Author
Andy Griffin



Joined: 01 May 2014
Posts: 3
Location: agriffin

PostPosted: Thu 01 May '14 17:31    Post subject: How to ajp redirect in Virtual Host Reply with quote

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

PostPosted: Fri 02 May '14 11:26    Post subject: Reply with quote

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

PostPosted: Fri 02 May '14 17:52    Post subject: Reply with quote

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

PostPosted: Mon 05 May '14 16:37    Post subject: Reply with quote

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

PostPosted: Tue 06 May '14 18:59    Post subject: Reply with quote

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

PostPosted: Fri 09 May '14 11:50    Post subject: Reply with quote

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

PostPosted: Wed 14 May '14 15:35    Post subject: Reply with quote

What is the intention?
Load-balancing?
Back to top
chongster



Joined: 04 Jun 2014
Posts: 9

PostPosted: Wed 04 Jun '14 18:12    Post subject: Reply with quote

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


Reply to topic   Topic: How to ajp redirect in Virtual Host View previous topic :: View next topic
Post new topic   Forum Index -> Apache