If I use the Channel class in a Lua script to replace the contents of an
HTTP/1.1 message, I do it like this:
local response = txn.res:dup()
// not shown: get response body, past HTTP headers and store in 'body'
variable
// not shown: modified 'body' and saved as 'body2'
response = response:gsub(body, body2)
response = response:gsub("Content-Length: " .. body:len(),
"Content-Length: " .. body2:len())
txn.res:set(response)
txn.done(txn)
The response is truncated in the browser if body2 is longer than body.
How can I increase the size of the buffer?
Side Note: I tried using 'txn.res:append(response)' instead of
'txn.res:set(response)', but it throws an error:
runtime error: /etc/haproxy/cors.lua:45: bad argument #2 to 'append'
(number expected, got no value) from [C] method 'append',
/etc/haproxy/cors.lua:45 C function line 16.
Thanks,
Nick Ramirez