diff --git a/cmd/cloudflared/shell/launch_browser_unix.go b/cmd/cloudflared/shell/launch_browser_unix.go index d9824214..519c0999 100644 --- a/cmd/cloudflared/shell/launch_browser_unix.go +++ b/cmd/cloudflared/shell/launch_browser_unix.go @@ -3,9 +3,15 @@ package shell import ( + "os" "os/exec" ) func getBrowserCmd(url string) *exec.Cmd { + // Check for Windows Subsystem for Linux (v2+). + if os.Getenv("WSL_DISTRO_NAME") != "" { + return exec.Command("rundll32.exe", "url.dll,FileProtocolHandler", url) + } + return exec.Command("xdg-open", url) }