RussellLuo / caddy-ext

Various Caddy v2 extensions (a.k.a. modules).
MIT License
93 stars 19 forks source link

Specify host for layer4 #19

Open Miggets7 opened 11 months ago

Miggets7 commented 11 months ago

Hi,

Is it possible to specify a host/domain for a service?

I'm using the caddy-docker-proxy module in combination with yours with this label:

labels:
        caddy.layer4.:27017.proxy: "{{upstreams 27017}}"

which generates this caddy part:

"layer4": {
      "servers": {
        "srv0": {
          "listen": [":27017"],
          "routes": [
            {
              "handle": [
                {
                  "handler": "proxy",
                  "upstreams": [{ "dial": ["10.0.22.76:27017"] }]
                }
              ]
            }
          ]
        }
      }
    }

But I would like to specify the host/domain, so I could have multiple services running on the same port. Is it possible?

arashsm79 commented 11 months ago

Check out section 5 of this comment. It tries to multiplex HTTPS and SSH by having layer4 itself listen on 433. It uses SSH and SNI matchers along with the subroute handler; I'm not sure if caddy-ext/layer4 supports those.

Miggets7 commented 10 months ago

@arashsm79 Not sure how the link should help me?