add Set up source button for optional adapters and fix cache headers
CI / compose (push) Failing after 5m40s
CI / compose (push) Failing after 5m40s
This commit is contained in:
@@ -25,6 +25,15 @@ class ProxyStaticHandler(SimpleHTTPRequestHandler):
|
||||
self.end_headers()
|
||||
self.wfile.write(payload)
|
||||
|
||||
def end_headers(self):
|
||||
# Always revalidate HTML and JS assets so new releases are picked up.
|
||||
content_type = self.headers.get("Content-Type", "")
|
||||
if "text/html" in content_type or "text/javascript" in content_type or "application/javascript" in content_type:
|
||||
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
|
||||
self.send_header("Pragma", "no-cache")
|
||||
self.send_header("Expires", "0")
|
||||
super().end_headers()
|
||||
|
||||
def _proxy_request(self) -> None:
|
||||
parsed = urlsplit(self.path)
|
||||
if parsed.path == "/api" or parsed.path.startswith("/api/"):
|
||||
@@ -60,6 +69,7 @@ class ProxyStaticHandler(SimpleHTTPRequestHandler):
|
||||
for key, value in response.getheaders():
|
||||
if key.lower() in {"content-type", "content-length", "cache-control", "location", "set-cookie"}:
|
||||
self.send_header(key, value)
|
||||
self.send_header("Cache-Control", "no-store, private")
|
||||
self.end_headers()
|
||||
self.wfile.write(payload)
|
||||
except (OSError, http.client.HTTPException) as exc:
|
||||
|
||||
Reference in New Issue
Block a user