Small update! After some research I think this is possible with SPOE/SPOA. Still not sure if it's possible with the LUA engine.
So right now I'm trying to figure out how to load and modify the body of a request using https://github.com/haproxy/spoa-server /Elias On Wed, Jun 2, 2021 at 9:06 PM Elias Abacioglu < [email protected]> wrote: > On Wed, Jun 2, 2021 at 6:28 PM Илья Шипицин <[email protected]> wrote: > >> application usually knows the best whether its requests might be cached >> or not. >> for example, html5 manifest can prevent from F5 storms. >> >> it is always better to shift caching activity to app level >> > > Hi Ilya, > > This discussion has gone a bit sideways, POST requests caching wasn't > really the question here. I just assumed I would be able to do it with > HAProxy and was informed that it was not possible when I described why I > wanted to modify POST requests. > Great, good to know and constructive, I've already solved that by using > nuster, which uses upstream(or is it downstream) HAProxy and adds > additional cache features. > So even if the backend API has a L1 (in-jvm-memory) and L2 (memcached) > cache, response time is 80-100ms for my example query. With nuster cache I > have response times that are sub 10ms. So even if I decided not to follow > best practices or recommendations I already see great benefits for the > client and the backend. > > I certainly hope this is not taken the wrong way, I do appreciate the help > and feedback on what's the incorrect way to solve this problem. > But I do prefer actual answers of what's possible to do with HAProxy and I > guess this is a "for a hammer every problem is a nail" situation here. > > To avoid continuing the discussion about POST requests caching and best > practices in other software outside of my control and how stuff would work > in an utopian situation I am going to explain who I am not. > I am not an application developer, I do not control any client software, > nor do I control clients requests outside of the load balancer, nor do I > write the software for the underlying API. > I do however want to serve the clients to the best of my ability even if > they do not follow best practices, so consider me the hammer and I'm going > to solve my problems using the only nail I have, HAProxy(nuster). > Rewriting software where the client requests comes from would take a long > time and is something that is outside of my control. I am simply looking > for help on what I can do with HAProxy. > > So my question was, can I do body transformations of POST requests with > HAProxy? > - The answer I'm looking for is "YES using this technique or feature, but > I would not recommend..." or "NO, not with HAProxy, use another software", > even if the YES comes with a strong discouragement I would still take it. > At least then I would know where to look and be able to try it to decide if > it works for me or not. > > Thanks for understanding. > Elias >

