Le 11/23/22 à 06:59, Carlhens Baptiste a écrit :
Hi,

I am trying to figure out how to use multiple |http-check| in my backend. I can’t figure out the proper syntax. Any help is appreciated.

backend avax-mainnet
option httpchk
stick-table type ip size 1m expire 1h
stick on src
balance leastconn
http-check send meth POST uri /ext/info hdr Content-Type application/json body "{"jsonrpc":"2.0","method":"info.isBootstrapped","params":[{"chain": "C"}],"i>
http-check expect rstring "isBootstrapped":true
http-check send meth POST uri /ext/info hdr Content-Type application/json body "{"jsonrpc":"2.0","method":"info.isBootstrapped","params":[{"chain": "q2aTwKuy>
http-check expect rstring "isBootstrapped":true
http-check send meth POST uri /ext/info hdr Content-Type application/json body "{"jsonrpc":"2.0","method":"info.isBootstrapped","params":[{"chain": "2K33xS9A>
http-check expect rstring "isBootstrapped":true
default-server inter 5s fall 3 rise 2 on-marked-down shutdown-sessions
server mun2np001 10.0.2.10:9650 check


Hi,

To send several requests, you must add an "http-check connect" rule between each
request. It means the first request must be an "http-check connect" rule. The
first one is implicit when there is only one request. In this case, it must be
defined.

In addition, if you want to match the double quotes, you must escape them.
Double quotes must also be escape for the body string. Spaces too. But it is
probably easier to enclose all the body between simple quotes.

Finally, a "string" matching method is a better solution in your case because
your pattern is not a regex.

To sum up, here is how it should be written:

http-check connect
http-check send meth POST uri /ext/info hdr Content-Type application/json body 
'"{"jsonrpc":"2.0","method":"info.isBootstrapped","params":[{"chain": "C"}],"i>'
http-check expect string \"isBootstrapped\":true
httpc-check connect
http-check send meth POST uri /ext/info hdr Content-Type application/json body 
'"{"jsonrpc":"2.0","method":"info.isBootstrapped","params":[{"chain": 
"q2aTwKuy>'
http-check expect string \"isBootstrapped\":true
http-check connect
http-check send meth POST uri /ext/info hdr Content-Type application/json body 
'"{"jsonrpc":"2.0","method":"info.isBootstrapped","params":[{"chain": 
"2K33xS9A>'
http-check expect string \"isBootstrapped\":true

--
Christopher Faulet


Reply via email to