Http-response Lua Script is not called on http-request deny


#1

Hi

I have a haproxy.cfg something like this

acl req_deny_503 var(“txn.denystatus”) eq 503 – Line A
http-request deny deny_status 503 if req_deny_503 — Line B
http-response lua.audit-log-resp ---- Line C

lua.audit-log-resp

   .........
   core.register_action("audit-log-resp", {"http-res"}, function(txn)....

Problem:

If request is denied because of Line B above, lua.audit-log-resp is not executed , I want it it to be executed even for deny responses .

Is there any way we can do that ??
Can I change anything while registering Lua script to say it should be executed for deny responses as well ??

FYI: for regular cases(non deny cases) lua.audit-log-resp gets executed and works fine

Any insight is appreciated.

Thanks
Lalitha


#2

If you deny the request, the request is aborted. So, the response is never processed because there are no response.
If you want to execute some action, you must locate this action before the deny like this:

acl req_deny_503 var("txn.denystatus") eq 503 -- Line A
http-request lua.audit-log-resp if req_deny_503 ---- Line C'
http-request deny deny_status 503 if req_deny_503 --- Line B