How can I setup apache forward host.company.com -> server.company.com/host

Where server.company.com is the Apache server.

We have other services running like

service1. company.com -> server.company.com/service1
service2. company.com -> server.company.com/service2
service3. company.com -> server.company.com/service3

(these services run on the same server as the apache)

Which works fine.

As mentioned in the beginning, I want to setup apache forwarding so that if I try to access host.company.com/customerX then it should be forwarded to server.company.com/host/customerX, where X = 1,2,3...

Where this customerX runs on other server.

My experience in setting this is limited and could someone guide me how to set this up


I don't know what you mean by "forwarding", but the traditional method is to use a proxy to a jboss backend.

Read this to get you started: http://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html


I don't know much about Jboss, so I am uncertain if you can simply connect to AJP there. However in case you can't you can try and achieve that using mod_proxy. Should go like this

<IfModule mod_proxy.c>
   ProxyPass /host http://host.company.com/
   ProxyPassReverse /host http://host.company.com/

Keep track of the obligatory security measurements coming along with mod_proxy. You can place this snippet in a VirtualHost context for server.company.com

If you can verify that you got AJP running on jboss (normally port 8009), you can use the same snippet replacing http:// with ajp:// adding :8009 to the URL.

<IfModule mod_proxy_ajp.c>
   ProxyPass /host ajp://host.company.com:8009/
   ProxyPassReverse /host ajp://host.company.com:8009/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.