use Cache-Control for posts images
This commit is contained in:
parent
87706dcc4c
commit
214414ad04
1 changed files with 8 additions and 1 deletions
|
|
@ -304,7 +304,14 @@ let get_post_image ~thumbnail request =
|
|||
| Ok image_opt -> (
|
||||
match image_opt with
|
||||
| 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 nick = Dream.param request "user" in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue