Skip to content

Commit fbfab5d

Browse files
committed
fix(nginx): add Cache-Control no-cache for HTML responses to prevent stale SPA shell after deploy
1 parent d81a887 commit fbfab5d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

conf/prace.spseol.cz.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# no-cache only for HTML responses, leave static assets untouched
2+
map $upstream_http_content_type $html_cache_control {
3+
~text/html "no-cache";
4+
default "";
5+
}
6+
17
server {
28
server_name _;
39

@@ -55,6 +61,7 @@ server {
5561
add_header X-Content-Type-Options "nosniff";
5662
add_header X-Frame-Options "SAMEORIGIN";
5763
add_header X-XSS-Protection "1; mode=block";
64+
add_header Cache-Control $html_cache_control;
5865

5966
ssl_certificate /etc/letsencrypt/live/prace.spseol.cz/fullchain.pem;
6067
ssl_certificate_key /etc/letsencrypt/live/prace.spseol.cz/privkey.pem;

0 commit comments

Comments
 (0)