Allow not serving the toplevel domain
This commit is contained in:
parent
a90c68bf5e
commit
5ef2e14ae9
9 changed files with 60 additions and 17 deletions
|
|
@ -62,7 +62,7 @@ func (panel *UserPanel) sshRoute(ctx context.Context) http.Handler {
|
|||
return sc, err
|
||||
}
|
||||
|
||||
sc.Domain = panel.Config.HTTP.PrimaryDomain
|
||||
sc.Domain = panel.Config.HTTP.PublicTopDomain()
|
||||
sc.Port = panel.Config.Listen.SSHPort
|
||||
|
||||
// pick the first domain that the user has access to as an example
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ func (home *Home) HandleRoute(ctx context.Context, route string) (http.Handler,
|
|||
dflt.Fallback = home.publicHandler(ctx)
|
||||
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
slug, ok := home.Config.HTTP.SlugFromHost(r.Host)
|
||||
slug, ok := home.Config.HTTP.NormSlugFromHost(r.Host)
|
||||
switch {
|
||||
case !ok:
|
||||
http.NotFound(w, r)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ func (server *Server) Server(ctx context.Context, progress io.Writer) (public ht
|
|||
|
||||
var publicM, internalM mux.Mux[component.RouteContext]
|
||||
publicM.Context = func(r *http.Request) component.RouteContext {
|
||||
slug, ok := server.Still.Config.HTTP.SlugFromHost(r.Host)
|
||||
slug, ok := server.Config.HTTP.NormSlugFromHost(r.Host)
|
||||
return component.RouteContext{
|
||||
DefaultDomain: slug == "" && ok,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ services:
|
|||
|
||||
- "traefik.enable=True"
|
||||
- "eu.wiss-ki.barrel.distillery=${DOCKER_NETWORK_NAME}"
|
||||
- "traefik.http.routers.control.rule=${HOST_RULE}"
|
||||
- "traefik.http.routers.core_panel.rule=${HOST_RULE}"
|
||||
|
||||
- "traefik.http.routers.fallback.rule=HostRegexp(`{catchall:.*}`)"
|
||||
- "traefik.http.routers.fallback.priority=1"
|
||||
- "traefik.http.routers.core_fallback.rule=HostRegexp(`{catchall:.*}`)"
|
||||
- "traefik.http.routers.core_fallback.priority=1"
|
||||
|
||||
- "traefik.http.routers.control.tls=${HTTPS_ENABLED}"
|
||||
- "traefik.http.routers.control.tls.certresolver=distillery"
|
||||
- "traefik.http.services.control.loadbalancer.server.port=8888"
|
||||
- "traefik.http.routers.core_panel.tls=${HTTPS_ENABLED}"
|
||||
- "traefik.http.routers.core_panel.tls.certresolver=distillery"
|
||||
- "traefik.http.services.core_panel.loadbalancer.server.port=8888"
|
||||
|
||||
|
||||
volumes:
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ func (server *Server) Stack() component.StackWithResources {
|
|||
|
||||
EnvContext: map[string]string{
|
||||
"DOCKER_NETWORK_NAME": server.Config.Docker.Network(),
|
||||
"HOST_RULE": server.Config.HTTP.DefaultHostRule(),
|
||||
"HOST_RULE": server.Config.HTTP.PanelHostRule(),
|
||||
"HTTPS_ENABLED": server.Config.HTTP.HTTPSEnabledEnv(),
|
||||
|
||||
"CONFIG_PATH": server.Config.ConfigPath,
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ func (ssh2 *SSH2) handleConnection(session ssh.Session) {
|
|||
{"${SLUG}", slug},
|
||||
{"${HOSTNAME}", slug + "." + ssh2.Config.HTTP.PrimaryDomain},
|
||||
|
||||
{"${DOMAIN}", ssh2.Config.HTTP.PrimaryDomain},
|
||||
{"${DOMAIN}", ssh2.Config.HTTP.PublicTopDomain()},
|
||||
{"${PORT}", strconv.FormatUint(uint64(ssh2.Config.Listen.SSHPort), 10)},
|
||||
|
||||
{"${HELP_URL}", ssh2.Config.HTTP.JoinPath("user", "ssh").String()},
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ func (ssh *SSH2) Stack() component.StackWithResources {
|
|||
|
||||
EnvContext: map[string]string{
|
||||
"DOCKER_NETWORK_NAME": ssh.Config.Docker.Network(),
|
||||
"HOST_RULE": ssh.Config.HTTP.DefaultHostRule(),
|
||||
|
||||
"CONFIG_PATH": ssh.Config.ConfigPath,
|
||||
"DEPLOY_ROOT": ssh.Config.Paths.Root,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue