tomcat - apache mod_proxy url does not work unless / is appended -




i have apache 2.4 setup mod_proxy load balance 2 tomcats. here addition httpd.conf

proxyrequests off proxypass /app balancer://mycluster stickysession=jsessionid|jsessionid  proxypassreverse /app balancer://mycluster <proxy balancer://mycluster>     balancermember http://tomcat1:8080/app route=tomcat1      balancermember http://tomcat2:8080/app route=tomcat2  </proxy> <location /balancer-manager>     sethandler balancer-manager     require granted </location> proxypass /balancer-manager ! <location /server-status>     sethandler server-status     require host localhost     require granted </location> 

from browser if try "http://localhost:7000/app" not work. if use "http://localhost:7000/app/" application comes up.

note additional "/" , end of url. how can additional / avoided?

update working structure:

proxyrequests off proxypass /app balancer://mycluster/app stickysession=jsessionid|jsessionid  proxypassreverse /app balancer://mycluster/app <proxy balancer://mycluster>     balancermember http://tomcat1:8080 route=tomcat1      balancermember http://tomcat2:8080 route=tomcat2  </proxy> <location /balancer-manager>     sethandler balancer-manager     require granted </location> proxypass /balancer-manager ! <location /server-status>     sethandler server-status     require granted </location> 

your balancer definitions wrong. in balancer definitions have define node, not uri handle.

**incorrect:** balancermember http://tomcat1:8080/app  ***correct:*** balancermember http://tomcat1:8080 

and handle uri-paths in proxypass

proxypass /app/ balancer://mycluster/app/ 


you can use:

proxypass /app balancer://mycluster/app 

note: balancer://mycluster same balancer://mycluster/. , there rule should follow avoid issues says if source has trailing slash target should have trailing slash, way avoid path mismatches in response backend.

note2: <location /server-status> has 2 require statements, since default require any, allowed because have require granted, makes no sense define require host localhost in context.





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

Asterisk AGI Python Script to Dialplan does not work -