Skip to content

request_body_filter not working in HttpModule #631

Description

@Sjain-dir

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! 🙏

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions