Skip to content

Commit 1ced837

Browse files
committed
Reduce public asset max-age
1 parent 4ef80aa commit 1ced837

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bin/main.ml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,15 @@ let public_loader _root path _request =
252252
| None ->
253253
Dream.empty `Not_Found
254254
| Some asset ->
255+
let max_age =
256+
match Filename.extension path with
257+
| ".woff" | ".woff2" | ".ico" ->
258+
31536000
259+
| _ ->
260+
86400
261+
in
255262
Dream.respond
256-
~headers:[("Cache-Control", "public, max-age=31536000")]
263+
~headers:[("Cache-Control", Printf.sprintf "public, max-age=%d" max_age)]
257264
asset
258265

259266
let static_routes =

0 commit comments

Comments
 (0)