Set short max_age for list.json

This commit is contained in:
sfan5
2024-11-03 12:42:37 +01:00
parent 5d191896f3
commit 4d320bbcf5
2 changed files with 5 additions and 3 deletions

View File

@@ -102,6 +102,8 @@ root /path/to/server/static;
rewrite ^/$ /index.html break; rewrite ^/$ /index.html break;
rewrite ^/list$ /list.json break; rewrite ^/list$ /list.json break;
location = /list.json { expires 20s; }
try_files $uri @uwsgi; try_files $uri @uwsgi;
location @uwsgi { location @uwsgi {
include uwsgi_params; include uwsgi_params;

View File

@@ -73,9 +73,9 @@ def index():
@app.route("/list") @app.route("/list")
def list_json(): def list_json():
# We have to make sure that the list isn't cached, # We have to make sure that the list isn't cached for too long,
# since the list isn't really static. # since it isn't really static.
return send_from_directory(app.static_folder, "list.json", max_age=0) return send_from_directory(app.static_folder, "list.json", max_age=20)
@app.route("/geoip") @app.route("/geoip")