cloudflare/pingora

`request_body_filter` not working in `HttpModule`

Closed this issue · 0 comments

I was trying to implement a custom HttpModule, and I noticed that request_header_filter is working as expected, but request_body_filter doesn’t seem to have any effect.

I looked into the code and found where request_header_filter is used:
https://github.com/cloudflare/pingora/blob/main/pingora-proxy/src/lib.rs#L519

However, I couldn’t find a similar place where HttpModule request_body_filter is invoked or handled.

this is how I am implementing it

#[async_trait]
impl HttpModule for JSONRPCModule {
    async fn request_header_filter(&mut self, _req: &mut RequestHeader) -> pingora_error::Result<()> {
        Ok(())
    }
    async fn request_body_filter(
        &mut self,
        body: &mut Option<Bytes>,
        end_of_stream: bool,
    ) -> pingora_error::Result<()> {
        self.req_body_filter_inner(body, end_of_stream)
            .await
            .expect("failed to filter request body");
        Ok(())
    }

    fn as_any(&self) -> &dyn Any {
        self
    }

    fn as_any_mut(&mut self) -> &mut dyn Any {
        self
    }
}

Am I looking in the right place?

Thanks in advance! 🙏