Spaces:
Running
Running
David Ko
commited on
Commit
ยท
0e9cdf3
1
Parent(s):
1fb1877
chore(api): add no-cache headers to serve_static to prevent stale frontend assets
Browse files
api.py
CHANGED
@@ -1256,7 +1256,12 @@ def logout():
|
|
1256 |
@app.route('/static/<path:filename>')
|
1257 |
def serve_static(filename):
|
1258 |
print(f"Serving static file: {filename}")
|
1259 |
-
|
|
|
|
|
|
|
|
|
|
|
1260 |
|
1261 |
# ์ธ๋ฑ์ค HTML ์ง์ ์๋น (๋ก๊ทธ์ธ ํ์)
|
1262 |
@app.route('/index.html')
|
|
|
1256 |
@app.route('/static/<path:filename>')
|
1257 |
def serve_static(filename):
|
1258 |
print(f"Serving static file: {filename}")
|
1259 |
+
resp = send_from_directory(app.static_folder, filename)
|
1260 |
+
# Prevent caching of static assets to reflect latest frontend changes
|
1261 |
+
resp.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
|
1262 |
+
resp.headers['Pragma'] = 'no-cache'
|
1263 |
+
resp.headers['Expires'] = '0'
|
1264 |
+
return resp
|
1265 |
|
1266 |
# ์ธ๋ฑ์ค HTML ์ง์ ์๋น (๋ก๊ทธ์ธ ํ์)
|
1267 |
@app.route('/index.html')
|