22
0
Fork 0

Check HTTP et Erreur 400 Bad Request

This commit is contained in:
jlecour 2023-01-31 14:47:06 +01:00
parent c0036c0000
commit 9aa589ab91
1 changed files with 18 additions and 0 deletions

View File

@ -890,4 +890,22 @@ index 578fbcd..6c0dd48 100644
endscript
dateext
}
~~~
## FAQ
### Check HTTP et Erreur 400 Bad Request
HAProxy 2.2 a modifié sonc omportement pour les checks HTTP (`option httpchk` dans un backend) et envoie désormais un en-tête `Content-Length: 0`.
Malheureusement certains serveurs (comme les ELB de AWS) n'aiment pas ça et renvoient une erreur `400 Bad Request`.
D'après [ce fil du forum d'HAProxy](https://discourse.haproxy.org/t/bad-request-on-health-check-due-to-content-length-header/6588) on peut contourner en faisant du HTTP dans un check TCP :
~~~
option tcp-check
tcp-check comment send\ HTTP\ request
tcp-check send GET\ /status\ HTTP/1.0\r\n
tcp-check send User-Agent:\ Haproxy\ Health\ Check\r\n
tcp-check send \r\n
tcp-check expect rstring HTTP/1\..\ 200 comment check\ HTTP\ response
~~~