diff --git a/cmd/tailscale/cli/serve.go b/cmd/tailscale/cli/serve.go index 244ce03d1..7691c7497 100644 --- a/cmd/tailscale/cli/serve.go +++ b/cmd/tailscale/cli/serve.go @@ -453,6 +453,7 @@ func expandProxyTarget(source string) (string, error) { if u.Port() != "" { url += ":" + u.Port() } + url += u.Path return url, nil } diff --git a/cmd/tailscale/cli/serve_test.go b/cmd/tailscale/cli/serve_test.go index c94f4ca9c..8031b2b02 100644 --- a/cmd/tailscale/cli/serve_test.go +++ b/cmd/tailscale/cli/serve_test.go @@ -262,6 +262,18 @@ func TestServeConfigMutations(t *testing.T) { }, }, }) + add(step{reset: true}) + add(step{ // support path in proxy + command: cmd("https / http://127.0.0.1:3000/foo/bar"), + want: &ipn.ServeConfig{ + TCP: map[uint16]*ipn.TCPPortHandler{443: {HTTPS: true}}, + Web: map[ipn.HostPort]*ipn.WebServerConfig{ + "foo.test.ts.net:443": {Handlers: map[string]*ipn.HTTPHandler{ + "/": {Proxy: "http://127.0.0.1:3000/foo/bar"}, + }}, + }, + }, + }) // tcp add(step{reset: true})