haproxy httpchk mit JSON-RPC

haproxy httpchk mit JSON-RPC

Ich muss das Backend mit einer POST JSON-RPC-Anfrage überprüfen. Habe alles versucht, es funktioniert nicht, das Backend kann den Text nicht analysieren. Irgendeine Idee, was ich falsch mache?

curl -vX POST http://localhost:5555 --data '{"jsonrpc":"2.0", "method":"xxx", "params":[],"id":1}'
* Connected to localhost (127.0.0.1) port 5555 (#0)
> POST / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:5555
> Accept: */*
> Content-Length: 53
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 63 out of 63 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Sat, 22 Aug 2015 15:28:33 GMT
< Content-Length: 39
<
{"id":1,"jsonrpc":"2.0","result":true}

Ich habe diese Konfiguration ausprobiert:

option httpchk POST / HTTP/1.1\r\nContent-Type: application/json\r\nContent-Length: 53\r\n\r\n{"jsonrpc":"2.0", "method":"xxx", "params":[],"id":1}

Antwort1

Wahrscheinlich müssen Sie die für die Prüfung verwendete Zeichenfolge ordnungsgemäß maskieren.

Du hast

option httpchk POST / HTTP/1.1\r\nContent-Type: application/json\r\nContent-Length: 53\r\n\r\n{"jsonrpc":"2.0", "method":"xxx", "params":[],"id":1}

Ich denke zwar, dass das besser funktionieren könnte

option httpchk POST / HTTP/1.1\r\nContent-Type:\ application/json\r\nContent-Length:\ 53\r\n\r\n{"jsonrpc":"2.0","method":"xxx","params":[],"id":1}

Die Unterschiede bestehen im Schrägstrich nach den Headern :„for“ Content-Typeund Content-Length„for“ sowie in der Entfernung aller Leerzeichen im JSON-„Body“.

Ich habe das nicht getestet, sehe aber keinen Grund, warum es nicht funktionieren sollte.

verwandte Informationen