У меня есть API с конечной точкой
POST / update_group
Тело состоит из:
{
"name": "customers",
"id": 2,
}
Мой шаблон HAProxy выглядит примерно так:
backend groups
mode http
option redispatch
option forwardfor
balance url_param name check_post
hash-type consistent
По какой-то причине, когда я отправляю почтовые запросы с телом, содержащим «имя», оно вращается между серверами в бэкэнде. Я хотел бы, чтобы всегда по умолчанию один. Кто-нибудь случайно узнает, что здесь происходит?
Документация HAProxy: url_param Параметр URL, указанный в аргументе, будет найден в строке запроса каждого запроса HTTP GET.
If the modifier "check_post" is used, then an HTTP POST
request entity will be searched for the parameter argument,
when it is not found in a query string after a question mark
('?') in the URL. The message body will only start to be
analyzed once either the advertised amount of data has been
received or the request buffer is full. In the unlikely event
that chunked encoding is used, only the first chunk is
scanned. Parameter values separated by a chunk boundary, may
be randomly balanced if at all. This keyword used to support
an optional <max_wait> parameter which is now ignored.
If the parameter is found followed by an equal sign ('=') and
a value, then the value is hashed and divided by the total
weight of the running servers. The result designates which
server will receive the request.
This is used to track user identifiers in requests and ensure
that a same user ID will always be sent to the same server as
long as no server goes up or down. If no value is found or if
the parameter is not found, then a round robin algorithm is
applied. Note that this algorithm may only be used in an HTTP
backend. This algorithm is static by default, which means
that changing a server's weight on the fly will have no
effect, but this can be changed using "hash-type".