0

I set my apache server with ajp to connect to my jboss server and it is working fine. But when I go to my domain http://mydomain.com, I see the jboss root page. I was wondering if I could use mod rewrite so when they type http://mydomain.com it gets redirected to http://mydomain.com/myapp. I just enable modwrite, but I tried to set it on my virtualost, and configtest send me an error when I was trying to set RewriteRule inside virtualhost.. Looking at the rule RewriteRule goes on the .htaccess. I have also other domains and apps on that machine so I dont want to set a global rule..

dawud
  • 14,918
  • 3
  • 41
  • 61
Juan Diego
  • 179
  • 1
  • 1
  • 11

1 Answers1

0

Consider this example:

<VirtualHost *:80>
  ...
  ProxyRequests off
  ProxyPassMatch ^/(app|app2|app3)(.*) ajp://localhost:8009/$1$2 ttl=120 ping=1
</VirtualHost>

What this snippet does is to match the incoming request against some known patterns and use the capabilities of mod_proxy and mod_proxy_ajp to pass that request to the backend, using backreferences ($1 and $2).

This way, you can use a VirtualHost entry to publish every applications hosted in the backend container, provided it can use an AJP listener.

Check the apache online docs for a detailed explanation on the rest of the parameters (ttl and ping)

dawud
  • 14,918
  • 3
  • 41
  • 61