Merge pull request #2453 from krzotr/patch-7
Fixed `Cache-Control` for .js and .css files - 10 minutes cache
This commit is contained in:
commit
7bf790003e
1 changed files with 3 additions and 3 deletions
|
@ -299,9 +299,6 @@ class UiRequest(object):
|
||||||
headers["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type, Accept, Cookie, Range"
|
headers["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type, Accept, Cookie, Range"
|
||||||
headers["Access-Control-Allow-Credentials"] = "true"
|
headers["Access-Control-Allow-Credentials"] = "true"
|
||||||
|
|
||||||
if content_type in ("text/plain", "text/html", "text/css", "application/javascript", "application/json", "application/manifest+json"):
|
|
||||||
content_type += "; charset=utf-8"
|
|
||||||
|
|
||||||
# Download instead of display file types that can be dangerous
|
# Download instead of display file types that can be dangerous
|
||||||
if re.findall("/svg|/xml|/x-shockwave-flash|/pdf", content_type):
|
if re.findall("/svg|/xml|/x-shockwave-flash|/pdf", content_type):
|
||||||
headers["Content-Disposition"] = "attachment"
|
headers["Content-Disposition"] = "attachment"
|
||||||
|
@ -312,6 +309,9 @@ class UiRequest(object):
|
||||||
content_type in ("application/javascript", "text/css")
|
content_type in ("application/javascript", "text/css")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if content_type in ("text/plain", "text/html", "text/css", "application/javascript", "application/json", "application/manifest+json"):
|
||||||
|
content_type += "; charset=utf-8"
|
||||||
|
|
||||||
if status in (200, 206) and cacheable_type: # Cache Css, Js, Image files for 10min
|
if status in (200, 206) and cacheable_type: # Cache Css, Js, Image files for 10min
|
||||||
headers["Cache-Control"] = "public, max-age=600" # Cache 10 min
|
headers["Cache-Control"] = "public, max-age=600" # Cache 10 min
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue