Skip to content

Ability to return errors from middleware #2544

Open
@justhaug

Description

I have looked for existing issues (including closed) about this

Feature Request

I essentially want to have a middleware that doesn't send back a response or status code at all. Something like one of towers layers which load shed or do filters (which doesn't work because Layers must have Infallible responses).

Motivation

The reason for this is to immediately get rid of malicious requests with as little compute as possible.

Proposal

No idea if this should be included in axum considering what is written here and I am not familiar enough with the internals of axum to know if it can be implemented without changing lots of traits.

Alternatives

I can just return a response without a body, this issue isn't a blocker. Feel free to close if it doesn't align with axum's current approach.

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