Caddy: let stppriv's admin gate skip the api rate limit
stppriv's Caddy asks /api/auth/validate-admin for every request it gates, all from its one LAN IP, which would exhaust the 30/s per-IP api bucket on a SilverBullet page load. Requests from STPPRIV_LAN_IP to that one path go straight to the backend. Public traffic always arrives from cloudflared's address, so it cannot match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -66,6 +66,20 @@ handle {$BACKEND_ENDPOINT}/ws* {
|
||||
}
|
||||
}
|
||||
|
||||
# stppriv's admin_gate checks every one of its requests here from one LAN IP,
|
||||
# so it would exhaust the per-IP api limit. Public traffic always arrives from
|
||||
# cloudflared, so it can never match.
|
||||
@stppriv_gate {
|
||||
path {$BACKEND_ENDPOINT}/auth/validate-admin
|
||||
remote_ip {$STPPRIV_LAN_IP}
|
||||
}
|
||||
handle @stppriv_gate {
|
||||
uri strip_prefix {$BACKEND_ENDPOINT}
|
||||
reverse_proxy {$BACKEND_HOST}:{$BACKEND_PORT} {
|
||||
import proxy
|
||||
}
|
||||
}
|
||||
|
||||
# On top of the backend's own 5/min.
|
||||
handle {$BACKEND_ENDPOINT}/auth/login* {
|
||||
import limit login 5 1m
|
||||
|
||||
Reference in New Issue
Block a user