connect handle return 404 when request is "CONNECT tokio.rs:443 HTTP/1.1" #341
Answered
by
davidpdrsn
shengsheng
asked this question in
Q&A
-
Cargo.toml [package]
name = "connect"
version = "0.1.0"
edition = "2018"
[dependencies]
axum = { version = "*", features = ["headers"] }
tokio = { version = "*", features = ["full"] }
headers = { version = "*" }
tower-http = { version = "*", features = ["trace"]}
tracing-subscriber = "*"
tracing = "*" src/main.rs use axum::body::Body;
use axum::handler::connect;
use axum::http::Request;
use axum::Router;
use std::net::SocketAddr;
use tower_http::trace::TraceLayer;
#[tokio::main]
async fn main() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "tower_http=trace")
}
tracing_subscriber::fmt::init();
let app = Router::new()
.nest("/", connect(handler).any(handler))
.layer(TraceLayer::new_for_http());
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
println!("listening on {}", addr);
axum::Server::bind(&addr)
.serve(app.into_make_service())
.await
.unwrap();
}
async fn handler(req: Request<Body>) {
dbg!(req);
}
Am I missing some hyper features in Cargo.toml? |
Beta Was this translation helpful? Give feedback.
Answered by
davidpdrsn
Sep 22, 2021
Replies: 1 comment 2 replies
-
Uhm what are you trying to do? |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
davidpdrsn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uhm what are you trying to do?