Le 02/04/2025 à 1:37 PM, Olivier D a écrit :
Hi,

Le mer. 2 avr. 2025 à 09:10, Christopher Faulet <cfau...@haproxy.com <mailto:cfau...@haproxy.com>> a écrit :

    In fact, in your case, it is expected to have no compression. You abort the
    request analysis, skipping this way the response analysis. It is equivalent 
to
    what happens with an "http-request deny". The compression is performed 
during
    the response analysis.

    To be able to compress a response returned from a lua script, you must use a
    service instead of an action that aborts the request. A lua service is an
    applet
    that is equivalent to a server. So the response analysis is performed and 
the
    response is no limited to one buffer. To do so, you must use the 
"use-service"
    action.



Unfortunately, I need to use an action in this case because I want the original backend to be called if my action does not return txn:done(). I also looked at implementing gzip compression at lua level but even if it works locally, It's quite difficult to package gzip support to official docker images used in kubernetes ingress controller.

Another solution is to set a variable in your lua action to redirect the request to a lua service if it is set. For instance:

  http-request lua.myscript if !static_content
  http-request use-service my-service.lua if { var(txn.intercept) -m found }

--
Christopher Faulet



Reply via email to