Skip to content

Commit

Permalink
use headscale server url as domain instead of base_domain
Browse files Browse the repository at this point in the history
Fixes #2336

Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Jan 10, 2025
1 parent ede4f97 commit 672359d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hscontrol/mapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ func generateUserProfiles(

var profiles []tailcfg.UserProfile
for _, user := range userMap {
profiles = append(profiles,
user.TailscaleUserProfile())
profiles = append(profiles, user.TailscaleUserProfile())
}

return profiles
Expand Down Expand Up @@ -455,7 +454,7 @@ func (m *Mapper) baseWithConfigMapResponse(

resp.DERPMap = m.derpMap

resp.Domain = m.cfg.BaseDomain
resp.Domain = m.cfg.Domain()

// Do not instruct clients to collect services we do not
// support or do anything with them
Expand Down
9 changes: 9 additions & 0 deletions hscontrol/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,15 @@ func validatePKCEMethod(method string) error {
return nil
}

func (c *Config) Domain() string {
u, err := url.Parse(c.ServerURL)
if err != nil {
return c.BaseDomain
}

return u.Hostname()
}

// LoadConfig prepares and loads the Headscale configuration into Viper.
// This means it sets the default values, reads the configuration file and
// environment variables, and handles deprecated configuration options.
Expand Down

0 comments on commit 672359d

Please sign in to comment.