0

I have a question about proxy and ajp module.

On my machine I have a Apache web server and a Tomcat servlet container.

On Tomcat is running a my java webapplication.

On Apache I have some services and I can call these in this way:

http://myhos/service1
http://myhos/service2
http://myhos/service3

I would configurate a ajp connector to call my tomcat webapplication from Apache. I would somethin as http://myhost to call the Tomcat webapp.

So, I configurated my apache in this way..and I have what I wanted: I can use http://myHost to visualize the Tomcat webApp by Apache.

<VirtualHost *:80>

    ProxyRequests off
    ProxyPreserveHost On

    ServerAlias myserveralias
    ErrorLog logs/error.log
    CustomLog logs/access.log common

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

     ProxyPass /server-status !
     ProxyPass /balancer-manager !

    ProxyPass / balancer://mycluster/ stickysession=JSESSIONID nofailover=Off maxattempts=1

    <Proxy balancer://mycluster>
       BalancerMember ajp://myIp:8009  min=10 max=100 route=portale loadfactor=1
       ProxySet lbmethod=bytraffic
    </Proxy>

    <Location /balancer-manager>
        SetHandler balancer-manager
        Order deny,allow
        Allow from localhost
    </Location>


    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent

</VirtualHost>

But, now I can't use the apache services:

If I use http://myhos/service1 I have an error because apache try to search service1 on my tomcatWebApp.

Is there a way to fix it?

Safari
  • 155
  • 1
  • 2
  • 7

1 Answers1

3

You can prevent your Apache services from being proxied to Tomcat by using the ! exclusion syntax, just like you're already doing for server-status and balancer-manager:

ProxyPass /service1 !
ProxyPass /service2 !
ProxyPass /service3 !
David Levesque
  • 3,523
  • 1
  • 18
  • 13