Automatic https when using caddy for domain and ip address together

Viewed 415

I am trying to access my website using both its domain name and static ip address via https protocol.

When I use just domain it works as expected, but when I add ip address as following:

my.domain.com {
  respond "Hello from domain"
}

10.20.30.40 {
    tls internal
    respond "Hello"
}

it does not work. Moreover if I use tls internal for different port:

my.domain.com {
  respond "Hello from domain"
}

:8080 {    <----------- Here I use port
    tls internal   <------------- and tls internal
    respond "Hello"
}

accessing by domain name in browser now warns that certs are not publicly trusted. I assume that tls internal in second block affected first block. Is it right? Why so?

Anyway, my main question is how to access my website both via domain name and ip address even if I need to use different ports with caddy over https. I know, that for some historical reason ip addresses cannot have publicly trusted certs so it is ok if ip address will use self signed certs.

pls help!

Caddy version: v2.3.0

0 Answers
Related