-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad request 400 #2
Comments
Are you using |
Oh of course I don’t. I followed the example from readme. That’s probably the missing bit! |
Well that didn't work. That's my setup: #[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let state = Arc::new(Database::new().await?);
let app = Router::new()
.route("/new-post", post(new_post))
.layer(Extension(state))
.route_layer(
RateLimitLayer::<RealIp>::builder()
.with_default_quota(Quota::simple(Duration::from_secs(5)))
.with_global_fallback(true)
.with_extension(true)
.default_handle_error(),
);
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
tracing::debug!("Listening on {}", listener.local_addr()?);
axum::serve(
listener,
app.into_make_service_with_connect_info::<SocketAddr>(),
)
.await?;
Ok(())
} |
Oh, is the |
|
Oh. You're using axum 0.8, aren't you? I created a new project with nearly your exact code using axum 0.7 and it worked fine, but if I use axum 0.8 it somehow still compiles fine but throws that 400 error. |
I'll find some time tonight/tomorrow to go through and upgrade to axum 0.8 for this crate, which may or may not be easy. |
Yeah I use axum v0.8. Seems like something changed and axum_gcra cannot fetch the client ip from it anymore. Thank you! |
Adding the
RateLimitLayer
configuration makes axum always return http 400.The text was updated successfully, but these errors were encountered: