I’m trying to get Caddy to serve a simple .html page when an ip is not present in the ipfilter list within my Caddyfile, which looks like this:
example.com {
gzip
errors {
502 /etc/caddy/down.html
}
proxy / 192.168.1.1:80 192.168.1.2:80 192.168.1.3:80 192.168.1.4:80 {
transparent
except /scripts /images
policy ip_hash
health_check /admin/pw.html
health_check_interval 10s
health_check_timeout 30s
}
proxy /scripts 192.168.0.1 {
transparent
}
proxy /images 192.168.0.1 {
transparent
}
tls data@example.com
redir 301 {
if {>X-Forwarded-Proto} is http
/ https://{host}{uri}
}
ipfilter / {
rule allow
blockpage /etc/caddy/down.html
ip 192.168.128.1 192.168.128.2
}
}
I have obfuscated the domain and the relevant IP addresses, but I hope you get the idea. When I try to access example.com
form an IP that is not 192.168.128.1
or 192.168.128.2
, my browser just downloads the html file as a Gzip archive.
How can I fix this, and what am I doing wrong?
EDIT: I just found that if I comment out the gzip config line, the blockpage is served correctly! So for now, I have gzip disabled, but how would I get blockpage
and gzip
to work together?
I forgot to include that I’m running Caddy 0.10.14 (non-commercial use only)
.