From fb84e2f8f001891e7d5a6951745f3f1b784fd20f Mon Sep 17 00:00:00 2001 From: yuuki <> Date: Fri, 31 Jan 2025 16:51:57 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AD=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5?= =?UTF-8?q?=E3=81=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index 0b25dcf..0c5af35 100644 --- a/app.py +++ b/app.py @@ -72,12 +72,11 @@ async def cloudflare(zone_id: str, x_token: Union[str, None] = Header()): json = result.json() res = JSONResponse(json) if "data" in json and not json["errors"]: - res.headers["Cache-Control"] = f"public, max-age=60, s-maxage=60" - res.headers["CDN-Cache-Control"] = f"max-age=60" + pass else: res.status_code = status.HTTP_500_INTERNAL_SERVER_ERROR - res.headers["Cache-Control"] = f"public, max-age=0, s-maxage=0" - res.headers["CDN-Cache-Control"] = f"max-age=0" + res.headers["Cache-Control"] = f"public, max-age=15, s-maxage=15" + res.headers["CDN-Cache-Control"] = f"max-age=15" return res @app.get("/api/cloudflare2") @@ -106,12 +105,11 @@ async def cloudflare2(zone_id: str, x_token: Union[str, None] = Header()): json = result.json() res = JSONResponse(json) if "data" in json and not json["errors"]: - res.headers["Cache-Control"] = f"public, max-age=60, s-maxage=60" - res.headers["CDN-Cache-Control"] = f"max-age=60" + pass else: res.status_code = status.HTTP_500_INTERNAL_SERVER_ERROR - res.headers["Cache-Control"] = f"public, max-age=0, s-maxage=0" - res.headers["CDN-Cache-Control"] = f"max-age=0" + res.headers["Cache-Control"] = f"public, max-age=15, s-maxage=15" + res.headers["CDN-Cache-Control"] = f"max-age=15" return res @app.get("/")