MINOR: http-ana: Use proxy's error replies to emit 401/407 responses
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 May 2020 07:57:28 +0000 (09:57 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 28 May 2020 13:07:20 +0000 (15:07 +0200)
commit612f2eafe907a4a6c07486274c90dc867e4e9e95
tree6bf54ee971997c43f6de9b1e6c986103b25cb9f9
parentae43b6c446ed99735e8ab2217ff35ca170649ed6
MINOR: http-ana: Use proxy's error replies to emit 401/407 responses

There is no reason to not use proxy's error replies to emit 401/407
responses. The function http_reply_40x_unauthorized(), responsible to emit those
responses, is not really complex. It only adds a
WWW-Authenticate/Proxy-Authenticate header to a generic message.

So now, error replies can be defined for 401 and 407 status codes, using
errorfile or http-error directives. When an http-request auth rule is evaluated,
the corresponding error reply is used. For 401 responses, all occurrences of the
WWW-Authenticate header are removed and replaced by a new one with a basic
authentication challenge for the configured realm. For 407 responses, the same
is done on the Proxy-Authenticate header. If the error reply must not be
altered, "http-request return" rule must be used instead.
doc/configuration.txt
include/common/http.h
src/http.c
src/http_ana.c