Fix cache control error of index.html
• Retrun no-cache for all HTML responses not just .html files • Prevent force browser refresh action after front-end rebuild
This commit is contained in:
parent
35cd567c9e
commit
f45dce347a
1 changed files with 3 additions and 1 deletions
|
|
@ -908,7 +908,9 @@ def create_app(args):
|
||||||
async def get_response(self, path: str, scope):
|
async def get_response(self, path: str, scope):
|
||||||
response = await super().get_response(path, scope)
|
response = await super().get_response(path, scope)
|
||||||
|
|
||||||
if path.endswith(".html"):
|
is_html = path.endswith(".html") or response.media_type == "text/html"
|
||||||
|
|
||||||
|
if is_html:
|
||||||
response.headers["Cache-Control"] = (
|
response.headers["Cache-Control"] = (
|
||||||
"no-cache, no-store, must-revalidate"
|
"no-cache, no-store, must-revalidate"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue