Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ http {
include /etc/nginx/blocked-ips*.map;
}

# The interactive API documentation (/ and /docs.json, served by
# vfbquery >= 1.22.42) is generated in-memory by the upstream from its
# *running* version, so it must never be cached: a cached copy would
# keep naming — and documenting — a vfbquery release that is no longer
# deployed, for up to CACHE_STALE_TIME after every upgrade. Both
# responses are tiny and cost the upstream nothing to serve fresh.
map $request_uri $is_api_docs {
default 0;
~^/(?:docs\.json)?(?:\?.*)?$ 1;
}

# Whitelist wins over blocklist and probe detection.
map "$is_whitelisted_ip:$is_blocked_ip" $should_block_ip {
default 0;
Expand Down Expand Up @@ -186,7 +197,8 @@ http {
add_header X-Cache-Status $upstream_cache_status;
add_header X-Cache-Key "$request_method$request_uri";
proxy_ignore_headers Cache-Control Expires Set-Cookie;
proxy_cache_bypass $force_refresh;
proxy_cache_bypass $force_refresh $is_api_docs;
proxy_no_cache $is_api_docs;
proxy_cache owlery_cache;
}
}
Expand Down Expand Up @@ -250,7 +262,8 @@ http {
add_header X-Cache-Status $upstream_cache_status;
add_header X-Cache-Key "$request_method$request_uri";
proxy_ignore_headers Cache-Control Expires Set-Cookie;
proxy_cache_bypass $force_refresh;
proxy_cache_bypass $force_refresh $is_api_docs;
proxy_no_cache $is_api_docs;
proxy_cache owlery_cache;
}
}
Expand Down
Loading