mirror of
https://github.com/fabriziosalmi/caddy-mib.git
synced 2025-12-23 22:17:43 -05:00
44 lines
1.7 KiB
Caddyfile
44 lines
1.7 KiB
Caddyfile
{
|
|
admin off
|
|
log {
|
|
level debug
|
|
output stdout
|
|
format console
|
|
}
|
|
}
|
|
|
|
:8080 {
|
|
route {
|
|
caddy_mib {
|
|
error_codes 404 500 401 # Error codes to track
|
|
max_error_count 10 # Global error threshold (reduced for faster testing)
|
|
ban_duration 5s # Global ban duration (reduced to 10 seconds)
|
|
ban_duration_multiplier 1 # Global ban duration multiplier
|
|
# whitelist 127.0.0.1 ::1 # Whitelisted IPs
|
|
log_level debug # Log level for debugging
|
|
ban_response_body "You have been banned due to excessive errors. Please try again later."
|
|
ban_status_code 429 # Custom status code for banned IPs
|
|
|
|
# Per-path configuration for /login
|
|
per_path /login {
|
|
error_codes 404 # Error codes to track for /login
|
|
max_error_count 5 # Error threshold for /login (reduced for faster testing)
|
|
ban_duration 10s # Ban duration for /login (reduced to 15 seconds)
|
|
ban_duration_multiplier 1
|
|
}
|
|
|
|
# Per-path configuration for /api
|
|
per_path /api {
|
|
error_codes 404 500 # Error codes to track for /api
|
|
max_error_count 8 # Error threshold for /api (reduced for faster testing)
|
|
ban_duration 15s # Ban duration for /api (reduced to 20 seconds)
|
|
ban_duration_multiplier 1
|
|
}
|
|
}
|
|
# All other requests, respond with "Hello World"
|
|
handle {
|
|
respond "Hello world!" 404
|
|
}
|
|
}
|
|
}
|