From d2f9578b683a91c6fc49c8c9f1113915250deb56 Mon Sep 17 00:00:00 2001 From: Damjan Georgievski Date: Sun, 22 Jul 2018 17:45:19 +0200 Subject: [PATCH] add some headers to the favicon * content-type to image/png * cache control for 24h --- src/web.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/web.rs b/src/web.rs index a110c0f..2ae613c 100644 --- a/src/web.rs +++ b/src/web.rs @@ -97,5 +97,8 @@ fn handle_tar(req: &HttpRequest) -> impl Responder { } fn favicon_ico(_req: &HttpRequest) -> impl Responder { - bytes::Bytes::from_static(include_bytes!("favicon.png")) + HttpResponse::Ok() + .content_type("image/png") + .header("Cache-Control", "only-if-cached, max-age=86400") + .body(bytes::Bytes::from_static(include_bytes!("favicon.png"))) }