Basic auth excluding local subnet

1. My Caddy version (caddy version):

v2 RC3

2. How I run Caddy:

Dockerized, standard

a. System environment:

Ubuntu 19 LTS

Is there a simple way to restrict basic_auth to only remote networks and not a local network? I see the way to define networks but cannot figure out how to limit basic_auth to certain networks.


Yep! You can use the not matcher with the remote_ip matcher in a named matcher block! It would look something along these lines:

@notLocal {
    not remote_ip
basicauth @notLocal {
1 Like

Awesome thank you!

1 Like

Should be: basicauth

1 Like

You’re right @axp, thanks for the correction - just copied that from the top post assuming it was correct.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.