varnish reconfig
This commit is contained in:
29
app.py
29
app.py
@@ -1377,7 +1377,18 @@ def inject_is_blocked():
|
||||
@app.before_request
|
||||
def require_system_password():
|
||||
endpoint = request.endpoint
|
||||
if endpoint in ("static_bp.serve_js_lib", "static_bp.serve_css_lib"):
|
||||
|
||||
if endpoint in (
|
||||
"static_bp.serve_js",
|
||||
"static_bp.serve_css",
|
||||
"static_bp.serve_js_lib",
|
||||
"static_bp.serve_css_lib",
|
||||
"favicon",
|
||||
"favicon_ico",
|
||||
):
|
||||
return
|
||||
|
||||
if endpoint in ("system_auth", "healthcheck", "robots_txt"):
|
||||
return
|
||||
|
||||
ip = request.access_route[0]
|
||||
@@ -1387,26 +1398,10 @@ def require_system_password():
|
||||
if endpoint is None:
|
||||
return
|
||||
|
||||
if endpoint in ("system_auth", "healthcheck", "robots_txt"):
|
||||
return
|
||||
|
||||
if (
|
||||
"authorized" not in request.cookies
|
||||
and not endpoint.startswith("login")
|
||||
and endpoint != "favicon"
|
||||
):
|
||||
|
||||
if endpoint == "static_bp.serve_js":
|
||||
requested_file = request.view_args.get("filename", "")
|
||||
if requested_file == "toasts.js":
|
||||
return
|
||||
if requested_file.endswith(".js"):
|
||||
return redirect(url_for("system_auth", next=request.url))
|
||||
return
|
||||
|
||||
if endpoint.startswith("static_bp."):
|
||||
return
|
||||
|
||||
if request.path == "/":
|
||||
return redirect(url_for("system_auth"))
|
||||
|
||||
|
Reference in New Issue
Block a user