caddy icon indicating copy to clipboard operation
caddy copied to clipboard

binding to an interface explicite is not possible multiple times

Open Nebdir opened this issue 1 year ago • 2 comments

when using the default_bind and a custom or multiple custom binds on the same address ar used caddy tries to bind 2 two or more times to the address.

using caddy v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=

setup: i have 3 services which need an upgrade from http to https, each listen on a local port now i specify with caddy 3 sections

1.example.com:443 {
  bind 10.0.0.5
  reverse_proxy to-a
}
2.example.com:443 {
  bind 10.0.1.5
  reverse_proxy to-b
}
3.example.com:443 {
  bind 10.0.0.5 10.0.1.5
  reverse_proxy to-c
}

so this does not work, even if i remove the bind of the last block.

Nebdir avatar May 17 '24 13:05 Nebdir

The problem is that the Caddyfile adapter would need to recognize that both of those bind addresses will exist on other servers that exclusively listen to that address, then copy the routes for your 3 domain to both of those. It's not currently smart enough to do that.

Run caddy adapt -p on your Caddyfile to see what I mean, Caddy produces servers with listen addresses, and the servers must not overlap otherwise they will try to bind to the same address.

francislavoie avatar May 17 '24 14:05 francislavoie

Oh... yeah, edge case. That is just a little more complicated than I wanted to do at the time. So if we're going to fix that we'll need to decide if it's worth the added complexity.

mholt avatar May 17 '24 15:05 mholt