Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf770fed83 |
@@ -160,7 +160,13 @@ echo "[$(date '+%Y-%m-%d %H:%M:%S')] Deploying to $WEBROOT..."
|
||||
# /var/www/html/config.json by lxc106-cinny.sh. The build ships a DEV default
|
||||
# (allowCustomHomeservers:true); rsyncing it would clobber the production config
|
||||
# on every deploy. Keep the app bundle and the runtime config separate.
|
||||
rsync -a --delete --exclude config.json dist/ "$WEBROOT/"
|
||||
# [matrix #23] Keep the previous builds' hashed assets for a while: a browser
|
||||
# still holding an older index.html (or service-worker precache) asks for its
|
||||
# assets/index-<old hash>.js, and deleting them on every deploy broke the app
|
||||
# for those users until their cached shell expired. Prune after 14 days.
|
||||
rsync -a --delete --exclude config.json --exclude assets/ dist/ "$WEBROOT/"
|
||||
rsync -a dist/assets/ "$WEBROOT/assets/"
|
||||
find "$WEBROOT/assets" -type f -mtime +14 -delete
|
||||
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ===== Deploy complete ($VITE_APP_VERSION) ====="
|
||||
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
# [matrix #23] SPA routes (/, /home/…, /login/…) are rewritten to /index.html
|
||||
# inside `location /`, where no cache headers were set: browsers then reused a
|
||||
# heuristically fresh shell after a deploy and requested deleted assets. Only
|
||||
# the rewritten shell gets no-cache; other files there keep their defaults.
|
||||
map $uri $lotus_shell_cache_control {
|
||||
/index.html "no-cache, no-store, must-revalidate";
|
||||
default "";
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
@@ -99,6 +108,9 @@ server {
|
||||
}
|
||||
|
||||
location / {
|
||||
# add_header here drops the server-level headers, so include them again.
|
||||
include snippets/cinny-security-headers.conf;
|
||||
add_header Cache-Control $lotus_shell_cache_control always;
|
||||
rewrite ^/config\.json$ /config.json break;
|
||||
rewrite ^/manifest\.json$ /manifest.json break;
|
||||
rewrite ^/sw\.js$ /sw.js break;
|
||||
|
||||
Reference in New Issue
Block a user