tower-rs / tower-http

HTTP specific Tower utilities.
675 stars 156 forks source link

CorsLayer in 0.5 doesn't work with axum #438

Closed illuminatedwax closed 9 months ago

illuminatedwax commented 9 months ago

Bug Report

Version

v0.5.0

Platform

Linux stonefree 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2 15:18:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Crates

cors

Description

In trying to use CorsLayer with axum 0.6.18, I used the following code:

let mut app = Router::new().route("/foo", get(|| async {}));
app = app.layer(CorsLayer::permissive());

and get the following error:

----- ^^^^ the trait `tower_service::Service<Request<_>>` is not implemented for `Cors<Route>`

The error goes away when I use version 0.4.4.

seanmonstar commented 9 months ago

Axum is not yet able to be used with tower-http v0.5.