Skip to content

Commit 0b01e40

Browse files
committed
server: add serverURL flag for supporting alternative domains
Signed-off-by: Oli Strik <[email protected]>
1 parent 60a68d1 commit 0b01e40

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

flake.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@
153153
description = "Disable the TCP Listeners on tsnet and tailscaled";
154154
};
155155

156+
serverURL = mkOption {
157+
type = nullOr str;
158+
default = null;
159+
description = "Server URL to use instead of the tailscale FDQN";
160+
};
161+
156162
enableFunnel = mkOption {
157163
type = bool;
158164
default = false;
@@ -240,6 +246,7 @@
240246
args = lib.cli.toGNUCommandLineShell { mkOptionName = k: "-${k}"; } {
241247
hostname = cfg.settings.hostName;
242248
port = cfg.settings.port;
249+
server-url = cfg.settings.serverURL;
243250
local-port = cfg.settings.localPort;
244251
use-local-tailscaled = cfg.settings.useLocalTailscaled;
245252
unix-socket = cfg.settings.unixSocket;

tsidp-server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ var (
4343
flagDisableTCP = flag.Bool("disable-tcp", false, "disable the tcp listener on tsnet/tailscaled")
4444
flagFunnel = flag.Bool("funnel", false, "use Tailscale Funnel to make tsidp available on the public internet")
4545
flagHostname = flag.String("hostname", "idp", "tsnet hostname to use instead of idp")
46+
flagServerURL = flag.String("server-url", "", "server url to use instead of the tailscale FDQN.")
4647
flagDir = flag.String("dir", "", "tsnet state directory; a default one will be created if not provided")
4748
flagEnableSTS = flag.Bool("enable-sts", false, "enable OIDC STS token exchange support")
4849

@@ -181,7 +182,11 @@ func main() {
181182
*flagEnableSTS,
182183
)
183184

184-
srv.SetServerURL(strings.TrimSuffix(st.Self.DNSName, "."), *flagPort)
185+
if *flagServerURL != "" {
186+
srv.SetServerURL(*flagServerURL, *flagPort)
187+
} else {
188+
srv.SetServerURL(strings.TrimSuffix(st.Self.DNSName, "."), *flagPort)
189+
}
185190

186191
// Load funnel clients from disk if they exist, regardless of whether funnel is enabled
187192
// This ensures OIDC clients persist across restarts

0 commit comments

Comments
 (0)