mholt / caddy-l4

Layer 4 (TCP/UDP) app for Caddy
Apache License 2.0
1k stars 75 forks source link

How to corectly redirect a domain/subdomain and generate a certificate? #271

Open nitanmarcel opened 6 days ago

nitanmarcel commented 6 days ago

How to corectly redirect a domain/subdomain and generate a certificate?

This is my caddy file, but as soon as I make my request to my url, caddy takes over the request and layer4 isn't able to detect it.

Looking trough the issues, the line that causes this issue, is the exact one I need to automatically generate the certificate seems to be the same config that causes

git.marcelsoftware.dev {
    tls mail@marcelsoftware.dev {
        on_demand
    }
}
{
    debug
    acme_dns cloudflare 1234 
    dynamic_dns {
        provider cloudflare 1234
        domains {
            marcelsoftware.dev @ www
        }
        dynamic_domains
    }
    layer4 {
        0.0.0.0:587 {
            route {
                proxy localhost:1507
            }
        }
        0.0.0.0:993 {
            route {
                proxy localhost:1903
            }
        }
        0.0.0.0:6612 {
            route {
                proxy localhost:6611
            }
        }

        :443 {
            @secure tls sni git.marcelsoftware.dev
            route @secure {
                proxy :6610
            }
            @ssh ssh
            route @ssh {
                proxy :6611
            }
        }
    }
}

git.marcelsoftware.dev {
    tls mail@marcelsoftware.dev {
        on_demand
    }
}
nitanmarcel commented 6 days ago

Oh, I can use both caddy file and l4, one for http and one for ssh listening on port 22.

But I'm still curious about the ssl certificate thing