Le 6/8/22 à 15:22, Yuriy Ivkin a écrit :
Greetings!
Is the TXN.done(txn[, reply]) function in haproxy 2.6 what I am looking for ?
08.06.2022 12:53, Yuriy Ivkin пишет:
Greetings!
In the lua HTTP class did not find a method allows to override response body.
May be it is possible via some other methods ?
If not, are there any reasons should prevent me to write it ?
Hi,
It depends on what you want to achieve. If you want to return a custom response,
you can indeed register a lua action and call it in an http-response rule. You
can create a Reply object with some original response headers, if necessary, and
with a custom body. In this case, TXN.done() should be used.
However, this solution is limited to one buffer. You cannot stream the response
payload. In the same way, you must wait for the response body to rewrite it. But
only if the whole response fits in a buffer. With this solution, it is not
possible to rewrite a too big response body.
If you want to rewrite a large response, you must write a lua filter. It is more
difficult. The API is a bit rough. But it is more versatile.
--
Christopher Faulet