fix: add cache rules

This commit is contained in:
2026-03-18 04:33:57 +08:00
parent 905b87fa24
commit 8b9fc94874
2 changed files with 5 additions and 2 deletions
+3
View File
@@ -21,9 +21,12 @@ location = /s {
} }
# --- Serve frontend index.html at /s/ --- # --- Serve frontend index.html at /s/ ---
# no-store prevents Cloudflare and browsers from caching the HTML entry point,
# so updated ?v= cache-busters on CSS/JS are always picked up immediately.
location = /s/ { location = /s/ {
root /root/repo/urlshortener/static; root /root/repo/urlshortener/static;
try_files /index.html =404; try_files /index.html =404;
add_header Cache-Control "no-store";
} }
# --- Serve frontend static assets (CSS, JS, etc.) --- # --- Serve frontend static assets (CSS, JS, etc.) ---
+2 -2
View File
@@ -7,7 +7,7 @@
<meta name="description" content="URL Shortener"> <meta name="description" content="URL Shortener">
<title>Short · URL Shortener</title> <title>Short · URL Shortener</title>
<link rel="stylesheet" href="static/fonts.css"> <link rel="stylesheet" href="static/fonts.css">
<link rel="stylesheet" href="static/style.css"> <link rel="stylesheet" href="static/style.css?v=20260318">
</head> </head>
<body> <body>
<div id="bg" aria-hidden="true"></div> <div id="bg" aria-hidden="true"></div>
@@ -58,7 +58,7 @@
<div id="toast" class="toast" aria-live="polite"></div> <div id="toast" class="toast" aria-live="polite"></div>
<script src="static/app.js" defer></script> <script src="static/app.js?v=20260318" defer></script>
</body> </body>
</html> </html>