convert from mod_jk to proxy_ajp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

I am running into trouble when trying to change the configuration of an existing Apache2.2.3/Tomcat5.0 combination (on the same host), and replacing the current mod_jk connector by mod_proxy_ajp.
I have never used mod_proxy before.

This is the original configuration which works, using mod_rewrite and mod_jk, (lines numbered (n) for easy reference only ) :

<VirtualHost *:80>
....
DocumentRoot /srv/www/star1/docs
...
RewriteCond %{REQUEST_URI} !/servlet\.[^\.]+$      (1)
RewriteRule ^/xyz/(.*)$ /$1 [PT]               (2)
SetEnvIf REQUEST_URI "\.(htm|web|css|gif|jpg|js|html?)$" no-jk    (3)
<LocationMatch "/servlet\.[^.]+$">   (4)
  SetHandler jakarta-servlet  (5)
</LocationMatch>
...
</VirtualHost>

Expplanation :
URIs that need to be redirected to a "xyz" webapp under Tomcat all end in "servlet.xxxxxx?" and start with "/xyz/". Some URIs that start with /xyz/ are for static items, that I prefer to serve with Apache. But in such a case, I have to remove the /xyz/ prefix prior to serving the item.
So what is done above is :
(1) and (2) : for URI's which start with /xyz/ but are *not* for the webapp, remove the /xyz/ prefix and serve the result locally.
(3) for URIs that represent static items, also set the "no-jk" flag.
(4) and (5) redirect all URI's ending in "/servlet.xxxx" to Tomcat

There is a bit of overlap between some of the above, but it works fine.

Now I try to replace the above with a configuration using mod_proxy and mod_proy_ajp, as follows :

<VirtualHost *:80>
....
DocumentRoot /srv/www/star1/docs
...
ProxyRequests Off
<Proxy *>
  Order Allow,Deny
  Allow from all
</Proxy>
RewriteCond %{REQUEST_URI} !/servlet\.[^\.]+$
RewriteRule ^/xyz/(.*)$ /$1 [PT]
<LocationMatch "/servlet\.[^.]+$">
  ProxyPass ajp://localhost:8009
</LocationMatch>
...
</VirtualHost>

I am hoping with the above to make it so that a URI like
URI = "/xyz/....../servlet.myservlet?...."
will
a) not be touched by the RewriteRule (like before)
b) forwarded to Tomcat via mod_prox_ajp as
ajp://localhost:8009/xyz/....../servlet.myservlet?....

but I am getting "File not found" errors (from Apache) when trying to access links involving the servlet.
Like :
File "/srv/www/star1/docs/xyz/" not found.

This is true, the directory "/srv/www/star1/docs/xyz/" does not exist under the Apache document root. But this URI should be re-directed to Tomcat, and it does not seem to be. So, what am I doing wrong ?

Thanks in advance.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux