pieterlouw / caddy-net

Proxy server type for Caddy server (https://github.com/mholt/caddy)
Apache License 2.0
66 stars 11 forks source link

Trying to (reverse)proxy different domains on the same port #24

Open ThisIsTenou opened 4 years ago

ThisIsTenou commented 4 years ago

I'm trying to proxy tcp traffic to different servers depending on which domain has been used. Basically a simple tcp reverse proxy. When not specifying a domain, this works great - but only for a single server:

proxy :25565 192.168.14.10:25565 {
  host test1.domain.com
  tls off
}

This also, despite having "host" configured as a single domain, proxy's all traffic hitting the WAN-IP with port 25565.

Now, when trying to proxy different domains to different servers like this:

proxy test1.domain.com:25565 192.168.14.10:25565 {
  host test1.domain.com
  tls off
}

I'm getting the following error: Listen: listen tcp [WAN-IP-HERE]:25565: bind: cannot assign requested address Since the host-directive doesn't seem to do anything, stuff like

proxy :25565 192.168.14.10:25565 {
  host test1.domain.com
  tls off
}

proxy :25565 192.168.14.11:25565 {
  host test2.domain.com
  tls off
}

also doesn't work:Listen: listen tcp :25565: bind: address already in use

Have I just done something wrong or is there an issue with the proxy?