From 4f2fdb10a36689951d1883e9f503cde4fdb67bf4 Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Sun, 19 Apr 2020 18:41:29 +0200 Subject: WebSockets: send caching headers for static resources --- libs/surfaces/websockets/server.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'libs/surfaces') diff --git a/libs/surfaces/websockets/server.cc b/libs/surfaces/websockets/server.cc index 5b2306a135..2a69b5eff8 100644 --- a/libs/surfaces/websockets/server.cc +++ b/libs/surfaces/websockets/server.cc @@ -67,17 +67,23 @@ WebsocketsServer::WebsocketsServer (ArdourSurface::ArdourWebsockets& surface) * list of surfaces is available as a dynamically generated json file */ memset (&_lws_mnt_root, 0, sizeof (lws_http_mount)); - _lws_mnt_root.mountpoint = "/"; - _lws_mnt_root.mountpoint_len = strlen (_lws_mnt_root.mountpoint); - _lws_mnt_root.origin_protocol = LWSMPRO_FILE; - _lws_mnt_root.origin = _resources.index_dir ().c_str (); + _lws_mnt_root.mountpoint = "/"; + _lws_mnt_root.mountpoint_len = strlen (_lws_mnt_root.mountpoint); + _lws_mnt_root.origin_protocol = LWSMPRO_FILE; + _lws_mnt_root.origin = _resources.index_dir ().c_str (); + _lws_mnt_root.cache_max_age = 3600; + _lws_mnt_root.cache_reusable = 1; + _lws_mnt_root.cache_revalidate = 1; /* user defined surfaces in the user config directory */ memset (&_lws_mnt_user, 0, sizeof (lws_http_mount)); - _lws_mnt_user.mountpoint = "/user"; - _lws_mnt_user.mountpoint_len = strlen (_lws_mnt_user.mountpoint); - _lws_mnt_user.origin_protocol = LWSMPRO_FILE; - _lws_mnt_user.origin = _resources.user_dir ().c_str (); + _lws_mnt_user.mountpoint = "/user"; + _lws_mnt_user.mountpoint_len = strlen (_lws_mnt_user.mountpoint); + _lws_mnt_user.origin_protocol = LWSMPRO_FILE; + _lws_mnt_user.origin = _resources.user_dir ().c_str (); + _lws_mnt_user.cache_max_age = 3600; + _lws_mnt_user.cache_reusable = 1; + _lws_mnt_user.cache_revalidate = 1; _lws_mnt_root.mount_next = &_lws_mnt_user; -- cgit v1.2.3