Thanks Maxim, Vasility, The problem i was going to solve is to i needed to run my specific function that takes the data of request URL path, Headers and request body and determine and validate that all that data is correct before sending upstream, or else i would deny the request with 4xx code errors.
Handlers can only handle (from what i know) URL path and headers. Request body requires a request chain (ngx_chain_t)) to piece out the request body and handlers doesn't seem to have t ngx_chain_t unlike request body filters. Or maybe i am wrong in this case? Thank you, Muhammad Nuzaihan On Thu, Dec 14, 2023 at 4:01 AM Vasiliy Soshnikov <vasiliy.soshni...@gmail.com> wrote: > > Sorry I'm bad. I understood that header filters won't help you. Use the > ACCESS PHASE handler, it should work fine for you. > > On Wed, Dec 13, 2023 at 10:57 PM Vasiliy Soshnikov > <vasiliy.soshni...@gmail.com> wrote: >> >> Hello, >> >> > Is there something similar done before? >> I'm thinking that you would like to test the incoming path and execute some >> logic. >> >> You could use a header filter for that and also you could keep a body filter >> for handling the request body. >> Also pls take a look into PHASEs, I'm thinking you could try to add your own >> ACCESS PHASE. >> >> And the last one: for keeping your context (some variables or data) for this >> request between filters, phases you could use request's context. >> >> Probably, examples would help you: https://github.com/dedok/nginx-tutorials >> >> >> On Wed, Dec 13, 2023 at 10:56 AM Muhammad Nuzaihan <zai...@unrealasia.net> >> wrote: >>> >>> Hi, >>> >>> I need to process requests with only URI path (without body) for a module. >>> >>> It seems ngx_http_request_body_filter_pt is *not* executed whenever >>> there is a request without a body (it looked like it bypassed without >>> request body) and only ngx_http_output_body_filter_pt part of the >>> code is executed. >>> >>> For example i do a request curl curl like this: >>> >>> curl -vvvv -X POST http://localhost:8080/proxy/profile/alice/comment >>> >>> and i need to validate /proxy/profile/alice/comment in my module and >>> there is no http headers and no body. Only URI path. >>> >>> Is there something similar done before? >>> >>> Thank you, >>> Muhammad Nuzaihan >>> _______________________________________________ >>> nginx-devel mailing list >>> nginx-devel@nginx.org >>> https://mailman.nginx.org/mailman/listinfo/nginx-devel > > _______________________________________________ > nginx-devel mailing list > nginx-devel@nginx.org > https://mailman.nginx.org/mailman/listinfo/nginx-devel _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel