Skip to content

Commit

Permalink
allow for external IP range limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Jan 9, 2025
1 parent bd47cd2 commit b2a1a39
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions etc/Caddyfile.ctmpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ https://{{ $hosty }} {
# https://av.dev.archive.org
# https://av.dev.archive.org:5432

# NOTE: `trusted_proxies` is for `X-Forwarded-Host` header from something like nginx `proxy_pass`.
# NOTE: `trusted_proxies` is for `X-Forwarded-Host` header from something like nginx `proxy_pass`
# NOTE: 666.666.666.666 below is a fake IP that allows an external managment process (eg: a cron)
# to update perl/sed replace append IPs to that value dynamically if needed
# (eg: changing list of IP addresses)
{{ range services -}}
{{ range $tag, $services := service .Name|byTag -}}
{{- $service_name := (index $services 0).Name}}
Expand All @@ -103,7 +106,7 @@ https://{{ $hosty }} {

{{- $origin }} {
{{ if ne (env "ALLOWED_REMOTE_IPS_SERVICES") "" }}
@blocked not remote_ip {{ env "ALLOWED_REMOTE_IPS_SERVICES" }}
@blocked not remote_ip {{ env "ALLOWED_REMOTE_IPS_SERVICES" }} 666.666.666.666
respond @blocked Forbidden 403
{{ end }}

Expand Down

0 comments on commit b2a1a39

Please sign in to comment.