Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have apache in front of Jboss working on 80 port and jboss listens to 8080. Apache forwards every request to Jboss. So its quiet standard scenario nothing fancy . . .

My first task was to log real ip in jboss log. (Coz I have proxy inside apache server and rewrite Engine.)

<VirtualHost *:80>
  ServerName test.com
  ServerAlias test.com
  CustomLog /var/log/httpd/access.log combined

  RewriteEngine on
  RewriteLogLevel 5
  RewriteLog "/var/log/httpd/rewrite.log"
  RewriteRule   ^/test.txt$ /someurl/search.cgi?iHash=somehash [P]
  RewriteRule   ^/test2$ /just/static/url/ [P]
  ProxyRequests off
  <Proxy *>
      Order deny,allow
      Allow from all
 </Proxy>
       ProxyPass / http://test.com:8080/
        ProxyPassReverse / http://test.com:8080/

So I solved this problem with ajp:

<Location /test2>
 ProxyPass ajp://localhost:8009/just/static/url/
 ProxyPassReverse ajp://localhost:8009/just/static/url/
</Location>

But now the problem Is, that it only works for static url not with hashed url. The problem is that apache kinda redirects url, but i get HTTP Status 404 error from Jboss. Maybe someone had the same problem or know the solution. :)

share|improve this question

1 Answer 1

You can use mod_jk with ajp.

First configure Jboss to work with mod_jk, for example: jboss+jk

I supose I guess connector port settings to 8009. You can configure your apache with mod_jk and ajp for redirection. And mount your url with:

<IfModule mod_jk.c>
 # a list of Server instances
 JkWorkerProperty worker.list=JBossA
 # connection properties to instance A on localhost
 JkWorkerProperty worker.tomcatA.type=ajp13
 JkWorkerProperty worker.tomcatA.host=localhost
 JkWorkerProperty worker.tomcatA.port=8009
 # some other configuration
 JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
 # forwarding URL prefixes to Server instances
 JkMount /APPUrl/* JbossA
</IfModule>

and workers.properties with:

worker.list=jk-status
worker.jk-status.type=status
worker.jk-status.read_only=true
worker.list=jk-manager
worker.jk-manager.type=status
worker.list=jk-status
worker.jk-status.type=status
worker.jk-status.read_only=true
worker.list=jk-manager
worker.jk-manager.type=status
worker.balancer.error_escalation_time=0
worker.balancer.max_reply_timeouts=10
worker.balancer.balance_workers=node1
worker.node1.reference=worker.template
worker.node1.host=localhost
worker.node1.port=8109
worker.node1.activation=A
worker.balancer.balance_workers=node2
worker.node2.reference=worker.template
worker.node2.host=localhost
worker.node2.port=8209
worker.node2.activation=A
worker.template.type=ajp13
worker.template.socket_connect_timeout=5000
worker.template.socket_keepalive=true
worker.template.ping_mode=A
worker.template.ping_timeout=10000
worker.template.connection_pool_minsize=0
worker.template.connection_pool_timeout=600
worker.template.reply_timeout=300000
worker.template.recovery_options=3
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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