Skip to content

Commit aa0f2c3

Browse files
feat: update game image proxy settings for immediate cache revalidation
1 parent 99e99da commit aa0f2c3

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

nginx.conf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ server {
4343

4444
# Proxy game images to API server
4545
# API_IMAGES_URL will be replaced at runtime via entrypoint
46-
location /game-images/ {
46+
# ^~ prevents the static-assets regex below from intercepting .jpg/.png URLs
47+
location ^~ /game-images/ {
4748
set $api_images_url "API_IMAGES_URL_PLACEHOLDER";
4849
proxy_pass $api_images_url;
4950
proxy_set_header Host $host;
@@ -56,10 +57,11 @@ server {
5657
proxy_hide_header Cache-Control;
5758
proxy_hide_header Pragma;
5859
proxy_hide_header Expires;
59-
# 1-day cache so replaced images (same filename) are refreshed the next day.
60-
# The API sends ETags – nginx passes them through for conditional GET (304).
61-
expires 1d;
62-
add_header Cache-Control "public, max-age=86400, must-revalidate";
60+
# no-cache: browser must revalidate every request using the ETag.
61+
# If the image hasn't changed the API returns 304 (no body transferred).
62+
# This means a replaced image (same filename) is visible immediately.
63+
expires -1;
64+
add_header Cache-Control "no-cache, must-revalidate";
6365
}
6466

6567
# Cache static assets

0 commit comments

Comments
 (0)