Hi Jim,

I am using the module of mod_proxy_hcheck in the version of 2.4.23,  I have 
some questiones about the configuration, but I can not find the answer in the 
official website of apache and the internet because it is two young. ^_^

So the question's description:

If I put the configuration into the element of "VirtualHost", it will not work.

ProxyHCExpr ok234 {%{REQUEST_STATUS} =~ /^[234]/}
ProxyHCExpr ok23 {%{REQUEST_STATUS} =~ /^[23]/}
ProxyHCExpr in_maint {hc('body') !~ /The requested resource is not available/}
ProxyRequests Off

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "/usr/local/apache/htdocs"
    ServerName localhost
    ServerAlias localhost
    ProxyPass /examples balancer://cluster
    ProxyPassReverse /examples balancer://cluster
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common

ProxyHCExpr ok23 {%{REQUEST_STATUS} =~ /^[23]/}
ProxyHCExpr in_maint {hc('body') !~ /The requested resource is not available/}
ProxyRequests Off

<proxy balancer://cluster>
    BalancerMember http://localhost:8181/examples loadfactor=1 hcmethod=GET 
hcexpr=ok23 hcinterval=2 hcuri=/status
    BalancerMember http://localhost:8282/examples loadfactor=1 hcmethod=GET 
hcexpr=in_maint hcinterval=2 hcuri=/servlet
    ProxySet lbmethod=byrequests
</proxy>

</VirtualHost>

But if I put the configuration out of the element of "VirtualHost",  it will 
work well, but also not perfect.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "/usr/local/apache/htdocs"
    ServerName localhost
    ServerAlias localhost
    ProxyPass /examples balancer://cluster
    ProxyPassReverse /examples balancer://cluster
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

ProxyHCExpr ok234 {%{REQUEST_STATUS} =~ /^[234]/}
ProxyHCExpr ok23 {%{REQUEST_STATUS} =~ /^[23]/}
ProxyHCExpr in_maint {hc('body') !~ /The requested resource is not available/}
ProxyRequests Off

<proxy balancer://cluster>
    BalancerMember http://localhost:8181/examples loadfactor=1 hcmethod=GET 
hcexpr=ok23 hcinterval=2 hcuri=/status
    BalancerMember http://localhost:8282/examples loadfactor=1 hcmethod=GET 
hcexpr=in_maint hcinterval=2 hcuri=/servlet
    ProxySet lbmethod=byrequests
</proxy>

We can see the log in the tomcat1 and tomcat2 like this:
127.0.0.1 - - [31/Jul/2016:22:23:57 +0800] "GET /examples HTTP/1.0" 302 -
127.0.0.1 - - [31/Jul/2016:22:23:59 +0800] "GET /examples HTTP/1.0" 302 -
127.0.0.1 - - [31/Jul/2016:22:24:01 +0800] "GET /examples HTTP/1.0" 302 -

It is indicated that they are sending the heartbeat request to the 
tomcat(workers).  But you can see that the parameter of "hcuri" also is not 
affect, and this configuration does not satisfy our requirement we must put it 
into the virtulhost to distinguish the other request from other port.

Jim, Can you tell me how to config them? It is very important and critical for 
me, I have put in time  and effort to keep  this work. Thank you very much.

Best Regards
Bin



mb19890...@126.com

Reply via email to