Dynamically update host for http health check


#1

Hi,

I’m trying to use the http health check to check multiple backends, similar to this post:

I have the following configuration:

backend portal_http
mode http
http-request set-header X-Forwarded-Host dev002836.esri.com
option httpchk GET /arcgis/sharing/rest/content/items/382401ab2a924ad4ad0e93e071f09ddd
server dev005272.esri.com:7080 dev005272.esri.com:7080 check
server dev005273.esri.com:7080 dev005273.esri.com:7080 check

The problem is that the application expects a certain URL syntax when reaching that URL, (for example http://dev005272.esri.com:7080/arcgis/sharing/rest/content/items/382401ab2a924ad4ad0e93e071f09ddd) and will return a 301 if it doesn’t get it. Using the URL in the configuration returns a 301. This works as long as the backend isn’t down. If the backend is up and the URL is not accessible the response is still a 301, (following the redirect will of course return the 4XX or 5XX response code). The following health check configurations do work to get the 200 back:

option httpchk GET /arcgis/sharing/rest/content/items/382401ab2a924ad4ad0e93e071f09ddd HTTP/1.1\r\nHost:\ dev005272.esri.com:7080

or

option httpchk GET https://dev005272.esri.com:7080/arcgis/sharing/rest/content/items/382401ab2a924ad4ad0e93e071f09ddd

but the problem is it’s not checking both endpoints. Is there a way to dynamically set the Host header depending on the backend receiving the request?

Thanks for any help.