I know this has been asked before, but I don’t see any conclusive answers. One time JSON was mentioned, the other a matcher that doesn’t seem to exist. I checked the documentation of the JSON configuration, and I didn’t really see how I’d make a remote_ip rule.
The more I look into this, the more complicated it seems. I want to be able to access my (sub)domains via LAN, this way I can move certain services from LAN accessible sockets, to simpler architectures like CGI. At first I thought maybe I could use mDNS, it’d be the most ideal, since I wouldn’t have to even make rewrites on my local DNS server. Then I learned that mDNS lacks subdomains, .s in mDNS are apart of the domain, it’s quite messy. It’d be great if Caddy itself had an mDNS plugin.
I like Caddy, and would like to continue using it, but if there’s no solution here, maybe I can get some recommendations for other reverse proxies that have this functionality?
I don’t understand the requirements. Can you state the question in plain terms?
Read the other posts, if you try to access a Cloudflared domain (using the plugin), locally using LAN, you’ll get Secure Connection Failed over https and connection timeout errors over http, that’s what the other posts are about. There’s nothing you can do, because the pages require authenticating with the Cloudflare API, for whatever reason, this is also applied to LAN IPs, not just WAN IPs.
I usually just use split zone in my dns resolver so that lan clients use the lan IP instead of public IP. Caddy doesn’t really care about the IP as long as you have proper ssl certs for your hosted domains. Not sure what you mean with cloudflare authentication though.
Caddy+Cloudflare plugin, with this at the top of the Caddyfile.
I’m honestly not too sure what happened, might’ve been tired and typo-ed something, I apparently opened this post at 1 AM. I had some <(sub)domain> <host IP> rules in my $env:SystemRoot/system32/drivers/etc/hosts, I tried:
Doing a DNS query, and it was correct.
curl -vi http://domain.tld, and got a redirect.
curl -vi https://domain.tld, got an authentication error.
Put auto_https disable_redirects in the global part of my Caddyfile, then tried curl -vi http://domain.tld, and got a timeout error.
Deleted all my changes, wrote the post, then went to sleep.
A few days later (after you responded to me), I tried again, and it just worked…
My guesses would be:
Some typo in the hosts file.
Forgetting to clear DNS cache, I think the DNS query tool I use bypasses caching, but curl no (the most likely).
Forgetting to caddy reload -c /etc/caddy/Caddyfile (this one’s the least likely, because nothing in the file had to actually change).
I did mention, but it’d be nice if Caddy had some built in plugin for making (sub)domain->mDNS rules, it’d remove the manual work out of this. The sarayourfriend.pictures article I linked could very easily be a simple xcaddy plugin.