fix: nginx serves index.html with no-cache headers
Vite hashes all JS/CSS assets, so those can be cached for 30 days. But index.html must never be cached — it references the current hashes. Caching index.html meant users ran old JS after deploys. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3c0fd4f647
commit
d789586fca
@ -19,6 +19,10 @@ RUN echo 'server { \
|
|||||||
listen 3000; \
|
listen 3000; \
|
||||||
root /usr/share/nginx/html; \
|
root /usr/share/nginx/html; \
|
||||||
index index.html; \
|
index index.html; \
|
||||||
|
location = /index.html { \
|
||||||
|
expires -1; \
|
||||||
|
add_header Cache-Control "no-store, no-cache, must-revalidate"; \
|
||||||
|
} \
|
||||||
location / { \
|
location / { \
|
||||||
try_files $uri $uri/ /index.html; \
|
try_files $uri $uri/ /index.html; \
|
||||||
expires 30d; \
|
expires 30d; \
|
||||||
@ -44,4 +48,4 @@ RUN chown -R nginx:nginx /usr/share/nginx/html \
|
|||||||
&& chown -R nginx:nginx /var/log/nginx
|
&& chown -R nginx:nginx /var/log/nginx
|
||||||
|
|
||||||
# Expose HTTP port (NPM will handle HTTPS)
|
# Expose HTTP port (NPM will handle HTTPS)
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user