Skip to content

Local Middleware Not Working with route_dynamic in Crow #933

@rem0obb

Description

@rem0obb

I'm currently using Crow extensively for a project. After doing some research in the Crow repository and reviewing code and related issues, particularly Issue #717, I noticed a limitation: it seems that local middlewares cannot be applied using route_dynamic, especially when working with WebSocket protocols or standard web usage patterns.

For example:

app.route_dynamic(url)
   .middlewares<crow::App<middleware::websocket::JWTAuth>, middleware::websocket::JWTAuth>()
   .websocket(&app);

Based on my testing, the middleware isn’t properly applied within route_dynamic. This issue affects both WebSocket connections and regular web routes, making it difficult to implement route-specific logic like authentication or authorization using local middleware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionThe viability / implementation of the issue is up for debatefeatureCode based project improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions