feat: allow http head requests
This commit is contained in:
parent
39e72a8eb6
commit
7d332b7c31
25
src/main.rs
25
src/main.rs
|
@ -80,24 +80,27 @@ async fn main() -> std::io::Result<()> {
|
||||||
.app_data(db.clone())
|
.app_data(db.clone())
|
||||||
.app_data(expiry_watch_sender.clone())
|
.app_data(expiry_watch_sender.clone())
|
||||||
.app_data(config.clone())
|
.app_data(config.clone())
|
||||||
.service(web::resource("/").route(web::get().to(upload::index)))
|
.service(
|
||||||
|
web::resource("/")
|
||||||
|
.route(web::get().to(upload::index))
|
||||||
|
.route(web::head().to(upload::index)),
|
||||||
|
)
|
||||||
.service(web::resource("/upload").route(web::post().to(upload::upload)))
|
.service(web::resource("/upload").route(web::post().to(upload::upload)))
|
||||||
.service(
|
.service(
|
||||||
web::resource(["/upload/{id}", "/upload/{id}/{name}"])
|
web::resource(["/upload/{id}", "/upload/{id}/{name}"])
|
||||||
.route(web::get().to(upload::uploaded)),
|
.route(web::get().to(upload::uploaded))
|
||||||
|
.route(web::head().to(upload::uploaded)),
|
||||||
)
|
)
|
||||||
.service(Files::new("/static", "static").disable_content_disposition())
|
.service(Files::new("/static", "static").disable_content_disposition())
|
||||||
.default_service(web::route().to(not_found))
|
.default_service(web::route().to(not_found))
|
||||||
.service(
|
.service(
|
||||||
web::resource([
|
web::resource(["/{id:[a-z0-9]{5}}", "/{id:[a-z0-9]{5}}/{name}"])
|
||||||
"/{id:[a-z0-9]{5}}",
|
.wrap(Condition::new(
|
||||||
"/{id:[a-z0-9]{5}}/{name}",
|
config.enable_rate_limit,
|
||||||
])
|
Governor::new(&governor_conf),
|
||||||
.wrap(Condition::new(
|
))
|
||||||
config.enable_rate_limit,
|
.route(web::get().to(download::download))
|
||||||
Governor::new(&governor_conf),
|
.route(web::head().to(download::download)),
|
||||||
))
|
|
||||||
.route(web::get().to(download::download)),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue