Remote_ip but with DynDNS

Hello,
I
'm trying to use Caddy to filter access for some websites.
I want to resolve my website with remote_ip but with my dyndns is resolve (because my home ip is changing).

Did it exist a way to do this?

Regards
Quentin

Caddy version:
v2.6.2

Please fill out the help topic template, as per the forum rules.

@francislavoie

1. Caddy version:

v2.6.2

2. How I installed, and run Caddy:

Method with apt

a. System environment:

Debian GNU/Linux 10 (buster)

b. Command:

Start it with linux service system

d. My complete Caddy config:

https://analytics.qlaffont.com {
@allowedIpHome {
  remote_ip home.qlaffont.com
}
        tls qlaffont13@gmail.com
        encode zstd gzip
        reverse_proxy @allowedIpHome localhost:3400
}

3. The problem I’m having:

Impossible to use remote_ip with dns entry from Dyndns

4. Error messages and/or full log output:

Jan 31 15:56:47 vps795342 caddy[12510]: Error: sending configuration to instance: caddy responded with error: HTTP 400: {"error":"loading config: loading new config: loading http app module: provision http: server srv0: setting up route handlers: route 2: loading handler modules: position 0: loading module 'subroute': provision http.handlers.subroute: setting up subroutes: route 2: loading matcher modules: module name 'remote_ip': provision http.matchers.remote_ip: invalid IP address: 'home.qlaffont.com': ParseAddr(\"home.qlaffont.com\"): unexpected character (at \"home.qlaffont.com\")"}

Yeah, the remote_ip matcher is meant for IP addresses, not domain names, as its name would imply.

If you want a matcher that does DNS lookups, you’ll need to implement it yourself, as there’s nothing that could do that in vanilla Caddy:

But I’m not sure that what you’re trying to do makes sense. The remote_ip matcher looks at the IP address of the first-immediate client that’s connecting to your server.

What are you trying to do with this, exactly?

If you want a matcher that does DNS lookups, you’ll need to implement it yourself, as there’s nothing that could do that in vanilla Caddy

I’m not a pro of go, but I will try to do it. But for me, it’s a missing feature from remote_ip because for many clients their home IPs change frequently.

The use case is here, is to access to a remote website from my home. But my home IP change frequently so I want to resolve ip with dyndns entry.

I think you’d be better off using authentication for this, instead of relying on the remote IP. Use the basicauth directive, or you could set up Authelia with the forward_auth directive.

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