[OCaml] Mobile-friendly clone of cgit.
fix add Cache-Control header to static assets
Sets max-age=86400 (24h) so browsers cache static files instead of refetching on every page load.
lib/static_handler.ml
@@ -20,5 +20,11 @@
20
20
match Static_assets.read path with
21
21
| Some content ->
22
22
let content_type = Filename.extension path |> content_type_of_ext in
23
Removed:
Dream.respond ~headers:[ ("Content-Type", content_type) ] content
23
Added:
Dream.respond
24
Added:
~headers:
25
Added:
[
26
Added:
("Content-Type", content_type);
27
Added:
("Cache-Control", "public, max-age=86400");
28
Added:
]
29
Added:
content
24
30
| None -> Dream.respond ~status:`Not_Found "Not found"