Url rewriting in Apache HTTPD with mod_cluster

1.2k Views Asked by At

I am new to Apache. I have 2 jboss (Jboss as 7.1.1) and apache httpd server. I am using mod_cluster for load balancing. I wish to hide the jboss url from user and wish to show the user clean urls.

for e.g.

www.mydomain.com will be having my static website.
subdomain.mydomain.com should go to mydomain.com:8080/myapp
subdomain.mydomain.com/mypage.xhtml should go to mydomain.com:8080/myapp/mypage.xhtml
sumdomain.mydomain.com/myservice should go to mydomain.com:8080/myapp/service.xhtml?name=myservice

I have tried many things with no success. Can some one tell me if it is possible or not. And if possible what are the things I should do.

Thanks a lot in advance.

Regards.

2

There are 2 best solutions below

2
Arjang On

The reason you cannot do what you want is because you are trying to solve two very different problem at once. Separate them and solve them individually.

Load balancer: I usually use Proxy for load balancer. For example

<Proxy balancer://mycluster>
BalancerMember http://wn1.seco.com
BalancerMember http://wn2.seco.com
</Proxy>
ProxyPass /test balancer://mycluster

Redirect and Forwarding: use mode_rewrite to redirect specific URLs to a different ones.

RewriteEngine  on
RewriteRule    "^/foo\.html$"  "/bar.html" [PT]
0
Michal Karm Babacek On

You can use mod_cluster and still stay in control of ProxyPass directives. E.g. CreateBalancers 1 and then you could create the Proxies yourself ProxyPassMatch ^/static/ ! ProxyPass / balancer://qacluster stickysession=JSESSIONID|jsessionid nofailover=on ProxyPassReverse / balancer://qacluster ProxyPreserveHost on. See the relevant docs for mod_cluster 1.3.1.Final.