From 4d320bbcf552e8e565ae34e77566b76643e9628e Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 3 Nov 2024 12:42:37 +0100 Subject: [PATCH] Set short max_age for list.json --- README.md | 2 ++ server.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9065086..4dbdee3 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,8 @@ root /path/to/server/static; rewrite ^/$ /index.html break; rewrite ^/list$ /list.json break; +location = /list.json { expires 20s; } + try_files $uri @uwsgi; location @uwsgi { include uwsgi_params; diff --git a/server.py b/server.py index 9ce795a..082a484 100755 --- a/server.py +++ b/server.py @@ -73,9 +73,9 @@ def index(): @app.route("/list") def list_json(): - # We have to make sure that the list isn't cached, - # since the list isn't really static. - return send_from_directory(app.static_folder, "list.json", max_age=0) + # We have to make sure that the list isn't cached for too long, + # since it isn't really static. + return send_from_directory(app.static_folder, "list.json", max_age=20) @app.route("/geoip")