cmd/tailscale/cli: [serve] add support for proxy paths (#7800)

pull/7803/head
shayne 2 years ago committed by GitHub
parent d42d570066
commit 81fd00a6b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -453,6 +453,7 @@ func expandProxyTarget(source string) (string, error) {
if u.Port() != "" { if u.Port() != "" {
url += ":" + u.Port() url += ":" + u.Port()
} }
url += u.Path
return url, nil return url, nil
} }

@ -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 // tcp
add(step{reset: true}) add(step{reset: true})

Loading…
Cancel
Save