This commit is contained in:
Aevann1 2022-04-05 18:49:05 +02:00
parent 763a4126c5
commit e71095f563
11 changed files with 17 additions and 18 deletions

View file

@ -88,9 +88,8 @@ mail = Mail(app)
@app.before_request
def before_request():
host = request.headers.get("Host", "")
if host.strip().lower() != app.config["SERVER_NAME"].strip().lower(): return {"error":f"Unauthorized host provided ({host})."}, 401
if request.headers.get("CF-Worker", "") != "": return {"error":"Cloudflare workers are not allowed to access this website."}, 401
if request.host != app.config["SERVER_NAME"]: return {"error":"Unauthorized host provided."}, 401
if request.headers.get("CF-Worker"): return {"error":"Cloudflare workers are not allowed to access this website."}, 401
if request.method.lower() != "get" and app.config["READ_ONLY"]:
return {"error":f"{app.config['SITE_NAME']} is currently in read-only mode."}, 500