Compare commits
No commits in common. "fb84e2f8f001891e7d5a6951745f3f1b784fd20f" and "5badcd8a9f11f2c31db93c1804783cd20457ed6a" have entirely different histories.
fb84e2f8f0
...
5badcd8a9f
3 changed files with 12 additions and 10 deletions
14
app.py
14
app.py
|
@ -72,11 +72,12 @@ async def cloudflare(zone_id: str, x_token: Union[str, None] = Header()):
|
||||||
json = result.json()
|
json = result.json()
|
||||||
res = JSONResponse(json)
|
res = JSONResponse(json)
|
||||||
if "data" in json and not json["errors"]:
|
if "data" in json and not json["errors"]:
|
||||||
pass
|
res.headers["Cache-Control"] = f"public, max-age=60, s-maxage=60"
|
||||||
|
res.headers["CDN-Cache-Control"] = f"max-age=60"
|
||||||
else:
|
else:
|
||||||
res.status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
|
res.status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
|
||||||
res.headers["Cache-Control"] = f"public, max-age=15, s-maxage=15"
|
res.headers["Cache-Control"] = f"public, max-age=0, s-maxage=0"
|
||||||
res.headers["CDN-Cache-Control"] = f"max-age=15"
|
res.headers["CDN-Cache-Control"] = f"max-age=0"
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@app.get("/api/cloudflare2")
|
@app.get("/api/cloudflare2")
|
||||||
|
@ -105,11 +106,12 @@ async def cloudflare2(zone_id: str, x_token: Union[str, None] = Header()):
|
||||||
json = result.json()
|
json = result.json()
|
||||||
res = JSONResponse(json)
|
res = JSONResponse(json)
|
||||||
if "data" in json and not json["errors"]:
|
if "data" in json and not json["errors"]:
|
||||||
pass
|
res.headers["Cache-Control"] = f"public, max-age=60, s-maxage=60"
|
||||||
|
res.headers["CDN-Cache-Control"] = f"max-age=60"
|
||||||
else:
|
else:
|
||||||
res.status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
|
res.status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
|
||||||
res.headers["Cache-Control"] = f"public, max-age=15, s-maxage=15"
|
res.headers["Cache-Control"] = f"public, max-age=0, s-maxage=0"
|
||||||
res.headers["CDN-Cache-Control"] = f"max-age=15"
|
res.headers["CDN-Cache-Control"] = f"max-age=0"
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
fastapi[standard]==0.115.8
|
fastapi[standard]==0.115.7
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue