【发布时间】:2019-05-17 12:03:53
【问题描述】:
我正在使用 HAProxy Lua API。我想在 all http-request 和 http-response 事件上调用 Lua 操作。
这可以正常工作,除非 HAProxy 本身无法完成请求(例如,没有可用的后端)。在那种情况下,我找不到调用 Lua 的方法。
例如
listen appname
bind 0.0.0.0:8000
mode http
http-request lua.handle-request
http-response lua.handle-response
server hostname 127.0.0.1:8001 check
这工作正常,handle-request 和 handle-response 被调用,即使后端服务器返回 500 状态或其他错误。
但是,如果 HAProxy 本身找不到后端(本身返回 503),则调用 handle-request,而不是 handle-response。
我也尝试过使用 TCP 操作。
在这种情况下有什么方法可以运行 Lua 代码吗?
【问题讨论】: