Skip to content

Commit

Permalink
Set short max_age for list.json
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Nov 3, 2024
1 parent 5d19189 commit 4d320bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 4d320bb

Please sign in to comment.