deploy: enforce no-cache for index.html and version.js via publish-dir htaccess
This commit is contained in:
@@ -104,6 +104,8 @@ Notes:
|
||||
- Replace `yourdomain.com` with your real domain.
|
||||
- Script copies `deploy/apache/chgrid-vhost-snippet.conf`, runs `rebuildhttpdconf`, then restarts Apache via WHM restart command.
|
||||
- Snippet now includes no-cache headers for `/chgrid/` and `/chgrid/index.html` so client updates are not stuck on stale HTML.
|
||||
- `deploy_client.sh` also installs `/chgrid/.htaccess` from `deploy/apache/chgrid-public-htaccess`
|
||||
to force no-cache on `index.html` and `version.js` in shared-host setups.
|
||||
|
||||
## 7) Optional HTTPS relay for HTTP radio streams
|
||||
|
||||
|
||||
10
deploy/apache/chgrid-public-htaccess
Normal file
10
deploy/apache/chgrid-public-htaccess
Normal file
@@ -0,0 +1,10 @@
|
||||
# Chat Grid publish-dir cache policy.
|
||||
# Applied to /chgrid/.htaccess by deploy_client.sh.
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
<FilesMatch "^(index\.html|version\.js)$">
|
||||
Header set Cache-Control "no-store, no-cache, must-revalidate"
|
||||
Header set Pragma "no-cache"
|
||||
Header set Expires "0"
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
@@ -6,6 +6,7 @@ PUBLISH_DIR="${2:-/home/bestmidi/public_html/chgrid}"
|
||||
BASE_PATH="${3:-/chgrid/}"
|
||||
CLIENT_DIR="$REPO_ROOT/client"
|
||||
PHP_PROXY_DIR="$REPO_ROOT/deploy/php"
|
||||
PUBLIC_HTACCESS_SRC="$REPO_ROOT/deploy/apache/chgrid-public-htaccess"
|
||||
|
||||
if [[ ! -d "$CLIENT_DIR" ]]; then
|
||||
echo "error: client directory not found: $CLIENT_DIR" >&2
|
||||
@@ -28,6 +29,10 @@ if [[ -d "$PHP_PROXY_DIR" ]]; then
|
||||
rsync -a "$PHP_PROXY_DIR/" "$PUBLISH_DIR/"
|
||||
fi
|
||||
|
||||
if [[ -f "$PUBLIC_HTACCESS_SRC" ]]; then
|
||||
cp "$PUBLIC_HTACCESS_SRC" "$PUBLISH_DIR/.htaccess"
|
||||
fi
|
||||
|
||||
# Normalize publish permissions for restrictive shared-host PHP handlers.
|
||||
# - Directories must be executable/traversable.
|
||||
# - PHP/static files must not be group-writable.
|
||||
|
||||
Reference in New Issue
Block a user