diff options
author | Giacomo Cavalieri <giacomo.cavalieri@icloud.com> | 2024-01-04 19:17:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-04 18:17:19 +0000 |
commit | c6b89cae8fcef56b6420698f311a8955919037c6 (patch) | |
tree | 766cc0ed491dcdaa8cecb31fa73c7f45a4da37c7 | |
parent | a38889c285bef95359e36c93da37221126f96556 (diff) | |
download | lustre-c6b89cae8fcef56b6420698f311a8955919037c6.tar.gz lustre-c6b89cae8fcef56b6420698f311a8955919037c6.zip |
🔀 Disable caching for lustre/try (#32)
Co-authored-by: Hayleigh Thompson <me@hayleigh.dev>
-rw-r--r-- | src/http.ffi.mjs | 3 | ||||
-rw-r--r-- | src/http_ffi.erl | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/http.ffi.mjs b/src/http.ffi.mjs index 3f59933..d1989bf 100644 --- a/src/http.ffi.mjs +++ b/src/http.ffi.mjs @@ -30,6 +30,9 @@ const html = `<!DOCTYPE html> </html>`; const server = Http.createServer((req, res) => { + res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, private'); + res.setHeader('Pragma', 'no-cache'); + switch (true) { case req.url === "/": { res.setHeader("Content-Type", "text/html"); diff --git a/src/http_ffi.erl b/src/http_ffi.erl index 5304ee4..e9de7e7 100644 --- a/src/http_ffi.erl +++ b/src/http_ffi.erl @@ -1,5 +1,5 @@ -module(http_ffi). --export([serve/4]). +-export([serve/4, response_default_headers/0]). serve(Host, Port, OnStart, OnPortTaken) -> {ok, Pattern} = re:compile("name *= *\"(?<Name>.+)\""), @@ -62,6 +62,7 @@ serve(Host, Port, OnStart, OnPortTaken) -> {port, ActualPort}, {default_type, "text/html"}, {mime_types, mime_types()}, + {customize, ?MODULE}, {modules, [mod_alias, mod_dir, mod_get]} ]), @@ -100,3 +101,9 @@ mime_types() -> {"jpeg", "image/jpeg"}, {"png", "image/png"} ]. + +response_default_headers() -> + [ + {"cache-control", "no-store, no-cache, must-revalidate, private"}, + {"pragma", "no-cache"} + ]. |