Hi all,
I’m in the process of replacing my nginx reverse proxy with caddy. So far, something I haven’t been able to figure out how to do is require authentication based on the requesting host’s IP address. In nginx, the server entry would look something like this:
server {
listen 443;
server_name service.domain.com;
location / {
proxy_pass https://servicehost/;
proxy_redirect off;
satisfy any;
allow 10.0.0.0/8;
deny all;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}
}
In caddy though, I can’t figure out how to do this. I know how to use basicauth and ipfilter, but I can’t figure out how to combine them. Is there a way I can cascade these with a sort of if/else setup? Right now I’m using two different subdomains and two sets of directives, but that’s not optimal. I’ve tried duplicating the same directive with different settings, but that fails, which is to be expected.
Thanks!