Bug 66111 - Mod Hcheck works only inside virtualhost
Summary: Mod Hcheck works only inside virtualhost
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_hcheck (show other bugs)
Version: 2.4.52
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2022-06-09 16:59 UTC by Riccardo Vezzini
Modified: 2022-06-09 16:59 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Riccardo Vezzini 2022-06-09 16:59:39 UTC
I'm running an apache 2.4.52 compiled from source.

When I setup mod_proxy_hcheck *outside* a virtual host section, I encounter some issues.
inside webserver logs I found this entry:

/appl/apache/hcheck-www1-sd/logs/error_vhost_log:[Thu Jun 09 18:42:20.519298 2022] [proxy_hcheck:trace4] [pid 15022:tid 140163408184960] mod_proxy_hcheck.c(1110): AH10019: Missing unique per-server context: 02srv00p8m.hosts.eni.intranet (24fbe00:246d888) (no hchecks)

health check seems to be working (in backend's logs I found calls to my hcuri url) but nothing is traced inside webserver logs other than the "(no hchecks)" entry.

Our setup is pretty simple:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule watchdog_module modules/mod_watchdog.so
LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so

ProxyHCTemplate 200keep hcmethod=GET hcinterval=60 hcpasses=1 hcfails=3 hcuri=/pub/hc.html

<Proxy balancer://AppCluster>
  BalancerMember https://server1 route=1 hctemplate=200keep 
  BalancerMember https://server2 route=2 hctemplate=200keep
  ProxySet stickysession=APACHE_ROUTEID
  ProxySet lbmethod=bybusyness

If I add an ProxyHCTemplate or ProxyHCExpr entry inside the virtualhost block, even if not used, it seems to work flawlessy:

/appl/apache/hcheck-www1-sd/logs/error_vhost_log:[Thu Jun 09 18:55:32.655045 2022] [proxy_hcheck:debug] [pid 27347:tid 140163407734528] mod_proxy_hcheck.c(550): AH03249: DNS lookup failure for: www3.example.com:80
/appl/apache/hcheck-www1-sd/logs/error_vhost_log:[Thu Jun 09 18:55:32.655085 2022] [proxy_hcheck:debug] [pid 27347:tid 140163407734528] mod_proxy_hcheck.c(590): AH03251: Health check TCP Status (1) for 24ad1d8.
/appl/apache/hcheck-www1-sd/logs/error_vhost_log:[Thu Jun 09 18:55:34.686161 2022] [proxy_hcheck:debug] [pid 15022:tid 140163408184960] mod_proxy_hcheck.c(1125): AH03265: watchdog callback registered (_proxy_hcheck_ for server0)

/appl/apache/hcheck-www1-sd/logs/error_vhost_log:[Thu Jun 09 18:55:27.618657 2022] [proxy_hcheck:debug] [pid 15022:tid 140163408184960] mod_proxy_hcheck.c(1125): AH03265: watchdog callback registered (_proxy_hcheck_ for server0)
/appl/apache/hcheck-www1-sd/logs/error_vhost_log:[Thu Jun 09 18:55:29.621119 2022] [proxy_hcheck:debug] [pid 27347:tid 140163407734528] mod_proxy_hcheck.c(961): AH03258: _proxy_hcheck_ watchdog started.
/appl/apache/hcheck-www1-sd/logs/error_vhost_log:[Thu Jun 09 18:55:29.621661 2022] [proxy_hcheck:debug] [pid 27347:tid 140163407734528] mod_proxy_hcheck.c(975): AH03313: apr_thread_pool_create() with 16 threads succeeded
/appl/apache/hcheck-www1-sd/logs/error_vhost_log:[Thu Jun 09 18:55:32.625650 2022] [proxy_hcheck:trace3] [pid 27347:tid 140163407734528] mod_proxy_hcheck.c(1012): Checking balancer://foo worker: https://server1/  [1] (24ad1d8)

It seems to be the exact opposite of bug #1600579

Am I doing something wrong?