[PR #2851] [CLOSED] Fix Domain() to return BaseDomain instead of ServerURL hostname #2894

Closed
opened 2025-12-29 04:19:32 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2851
Author: @Copilot
Created: 11/1/2025
Status: Closed

Base: mainHead: copilot/investigate-issue-2833


📝 Commits (3)

  • abde3ef Initial plan
  • 43c91c8 Fix Domain() to return BaseDomain instead of ServerURL hostname
  • a9dcf48 Complete fix for issue #2833 - code review and security checks passed

📊 Changes

3 files changed (+9 additions, -18 deletions)

View changed files

📝 go.sum (+0 -6)
📝 hscontrol/mapper/builder_test.go (+5 -4)
📝 hscontrol/types/config.go (+4 -8)

📄 Description

Tailscale clients were displaying the external control server URL instead of the internal network domain (MagicDNS base_domain), particularly confusing on mobile where both labels showed the same value.

Root cause: Domain() method was parsing and returning the hostname from ServerURL instead of returning BaseDomain.

Changes:

  • hscontrol/types/config.go: Simplified Domain() to return BaseDomain directly
  • hscontrol/mapper/builder_test.go: Fixed test to use distinct ServerURL/BaseDomain values to properly validate behavior

Example:

// Before: Domain() returned "headscale.example.com" (from ServerURL)
cfg := &types.Config{
    ServerURL:  "https://headscale.example.com",
    BaseDomain: "internal.mynetwork.com",
}

// After: Domain() returns "internal.mynetwork.com" (from BaseDomain)
// Clients now show the tailnet's internal domain, not the control server URL

Fixes #2833

Original prompt

Investigate https://github.com/juanfont/headscale/issues/2833


Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/2851 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 11/1/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `copilot/investigate-issue-2833` --- ### 📝 Commits (3) - [`abde3ef`](https://github.com/juanfont/headscale/commit/abde3ef8b3ab651cc0204ce7612c6f2e3a51a6c7) Initial plan - [`43c91c8`](https://github.com/juanfont/headscale/commit/43c91c8161f041fd4f0ee45a7660d9344f2a509d) Fix Domain() to return BaseDomain instead of ServerURL hostname - [`a9dcf48`](https://github.com/juanfont/headscale/commit/a9dcf485650116bb18e97e3aef25804cea83f514) Complete fix for issue #2833 - code review and security checks passed ### 📊 Changes **3 files changed** (+9 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `go.sum` (+0 -6) 📝 `hscontrol/mapper/builder_test.go` (+5 -4) 📝 `hscontrol/types/config.go` (+4 -8) </details> ### 📄 Description Tailscale clients were displaying the external control server URL instead of the internal network domain (MagicDNS base_domain), particularly confusing on mobile where both labels showed the same value. **Root cause:** `Domain()` method was parsing and returning the hostname from `ServerURL` instead of returning `BaseDomain`. **Changes:** - `hscontrol/types/config.go`: Simplified `Domain()` to return `BaseDomain` directly - `hscontrol/mapper/builder_test.go`: Fixed test to use distinct ServerURL/BaseDomain values to properly validate behavior **Example:** ```go // Before: Domain() returned "headscale.example.com" (from ServerURL) cfg := &types.Config{ ServerURL: "https://headscale.example.com", BaseDomain: "internal.mynetwork.com", } // After: Domain() returns "internal.mynetwork.com" (from BaseDomain) // Clients now show the tailnet's internal domain, not the control server URL ``` Fixes #2833 <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > Investigate https://github.com/juanfont/headscale/issues/2833 </details> <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/juanfont/headscale/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 04:19:32 +01:00
adam closed this issue 2025-12-29 04:19:32 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2894