Skip to content

Commit 00c9416

Browse files
Trust Caddy forwarded client IPs so admin login throttling works per user
1 parent d4e90c0 commit 00c9416

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

nixos/admin-app/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
url_for, flash, session, jsonify, send_file
3030
)
3131
from flask_wtf.csrf import CSRFProtect
32+
from werkzeug.middleware.proxy_fix import ProxyFix
3233
from tunnel_utils import (
3334
build_connect_script,
3435
choose_invoice_action,
@@ -41,6 +42,8 @@
4142

4243
app = Flask(__name__, static_url_path="/box/static")
4344
app.secret_key = os.urandom(24)
45+
# Trust the single local Caddy proxy in front of the admin app.
46+
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1)
4447
csrf = CSRFProtect(app)
4548

4649
# Configuration

0 commit comments

Comments
 (0)