use Cache-Control for posts images

This commit is contained in:
Swrup 2022-04-04 17:33:49 +02:00
parent 87706dcc4c
commit 214414ad04

View file

@ -304,7 +304,14 @@ let get_post_image ~thumbnail request =
| Ok image_opt -> ( | Ok image_opt -> (
match image_opt with match image_opt with
| None -> Dream.respond ~status:`Not_Found "Image does not exists" | None -> Dream.respond ~status:`Not_Found "Image does not exists"
| Some image -> Dream.respond ~headers:[ ("Content-Type", "image") ] image ) | Some image ->
(* posts images do not change so we cache them *)
Dream.respond
~headers:
[ ("Cache-Control", "max-age=3628800, immutable")
; ("Content-Type", "image")
]
image )
let get_avatar_image request = let get_avatar_image request =
let nick = Dream.param request "user" in let nick = Dream.param request "user" in