Quantcast
Channel: Serverphorums.com - HAProxy
Viewing all articles
Browse latest Browse all 5112

Update host for http health check (1 reply)

$
0
0
Hi,

I'm trying to implement a health check within HAProxy but update the host depending on the backend server the request is sent to:

https://urldefense.proofpoint.com/v2/url?u=http-3A__discourse.haproxy.org_t_dynamically-2Dupdate-2Dhost-2Dfor-2Dhttp-2Dhealth-2Dcheck_1307&d=DwIFAg&c=n6-cguzQvX_tUIrZOS_4Og&r=GJnB0lPh2FOOOGp1IsgaOrZNJVEDsT8LNajwh6rzlsc&m=vN5hjS2ZffqxRHZ8uZJIe2YnBGUcGO2WC9NoLoYsxEQ&s=TMR4XO3M4zS8tb_Fzr6G6Y-BHR5-PuANr9sz2YCFTFo&e=

The background to this is that the application I'm working with requires an API to be accessed using the machines hostname. For example, if the participating machines were machine1.domain.com and machine2.domain.com, I would need to reach the API through https://urldefense.proofpoint.com/v2/url?u=http-3A__machine1.domain.com-3A7080_arcgis&d=DwIFAg&c=n6-cguzQvX_tUIrZOS_4Og&r=GJnB0lPh2FOOOGp1IsgaOrZNJVEDsT8LNajwh6rzlsc&m=vN5hjS2ZffqxRHZ8uZJIe2YnBGUcGO2WC9NoLoYsxEQ&s=vwD_SGgYKWtXSBtNl_xDfU98wPleZWtOvjQ8J4fYS5Y&e= or https://urldefense.proofpoint.com/v2/url?u=https-3A__machine1..domain.com-3A7443_arcgis&d=DwIFAg&c=n6-cguzQvX_tUIrZOS_4Og&r=GJnB0lPh2FOOOGp1IsgaOrZNJVEDsT8LNajwh6rzlsc&m=vN5hjS2ZffqxRHZ8uZJIe2YnBGUcGO2WC9NoLoYsxEQ&s=IuRx14HhsOFrwtphTMb_Hb9F1SY2j1N4o4LKogZLzE8&e= and https://urldefense.proofpoint.com/v2/url?u=http-3A__machine2.domain.com-3A7080_arcgis&d=DwIFAg&c=n6-cguzQvX_tUIrZOS_4Og&r=GJnB0lPh2FOOOGp1IsgaOrZNJVEDsT8LNajwh6rzlsc&m=vN5hjS2ZffqxRHZ8uZJIe2YnBGUcGO2WC9NoLoYsxEQ&s=4dyIVcrVm_t3puMKO6wuiixNm-_nDmtVc_d60YRCAbY&e= or https://urldefense.proofpoint.com/v2/url?u=https-3A__machine2.domain.com-3A7080_arcgis&d=DwIFAg&c=n6-cguzQvX_tUIrZOS_4Og&r=GJnB0lPh2FOOOGp1IsgaOrZNJVEDsT8LNajwh6rzlsc&m=vN5hjS2ZffqxRHZ8uZJIe2YnBGUcGO2WC9NoLoYsxEQ&s=RpPFLB0zKgPT7B1ej1NzVFcVL8rREK1cpe5lQ7731qQ&e= . If the request is sent with a different host, then it will return a 301. I have the following backend configuration in HAProxy:

backend in_http
option httpchk GET /arcgis/sharing/rest/
server machine1.domain.com:7080 machine1.domain.com:7080 check
server machine2.domain.com:7080 machine2.domain.com:7080 check

This returns a 301 for the health check, which will be OK as long as the web server is up but the URL is not reachable for some reason. Updating the configuration to be either one of the following returns a 200:

option httpchk GET /arcgis/sharing/rest/ HTTP/1.1\r\nHost:\ machine1.domain..com:7080

or

option httpchk GET https://urldefense.proofpoint.com/v2/url?u=https-3A__machine1.domain.com-3A7080_arcgis_sharing_rest_&d=DwIFAg&c=n6-cguzQvX_tUIrZOS_4Og&r=GJnB0lPh2FOOOGp1IsgaOrZNJVEDsT8LNajwh6rzlsc&m=vN5hjS2ZffqxRHZ8uZJIe2YnBGUcGO2WC9NoLoYsxEQ&s=bVat86zUCfhpxaRddpCNg21bdFfq32Qvfp6M1xXmUxc&e=

Each machine would ideally be checked, so I was interested if there was a way to dynamically update the host based on where the request was being sent:

option httpchk GET /arcgis/sharing/rest/ HTTP/1.1\r\nHost:\ %[req.hdr(host)]

or something similar. Any help is appreciated!

Thanks,
Jon

Viewing all articles
Browse latest Browse all 5112

Trending Articles