Add http-response configuration keys #915
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add option to overwrite any response payload issued by haproxy, or configured by haproxy ingress. This update might lead to backward incompatibility if a deployment already customize the Lua script with the haproxy ingress generated responses.
We're using two approaches here. One of them is implementing services in Lua, this gives some flexibility to issue codes that haproxy doesn't support like 495. The other approach is using HAProxy errorfile, which is the proper way to overwrite responses generated internally by HAProxy and hard to move to a Lua script, like 500 or 503. All of them however uses the same interface, so users don't need to bother if the overwrite will be made via errorfile or Lua script.
The implementation was also made in such a way that a response code can be changed, this is useful in scenarios that the client should be redirected via
302 Found
if there isn't a server available (503) or if the request is denied (403).