Adaptive rules depending on visiting address

1. Caddy version (caddy version):

v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=

2. The problem I’m having:

I was looking for a way to have my caddy-auth-portal/caddy-auth-jwt combination to protect my sites when my visiting address is outside of my LAN, but not when inside. I’m not really finding any caddy settings that would accomplish this, is it at all possible?
Is it even recommended?
I found this, but I’m not really sure if that’s right, let alone how to configure it if it’s actually correct :stuck_out_tongue:

Thanks in advance!

Yeah you could do like:

@external not remote_ip
route @external {
	# do auth

Those IP ranges are reserved for private networks, so anything in those ranges should be requests coming from inside your network. Using the not matcher inverts the logic so that you match any request coming from outside.

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