tailscale/ipn/ipnlocal
shayne c750186830
ipn/ipnlocal: [serve] Trim mountPoint prefix from proxy path (#7334)
This change trims the mountPoint from the request URL path before
sending the request to the reverse proxy.

Today if you mount a proxy at `/foo` and request to
`/foo/bar/baz`, we leak the `mountPoint` `/foo` as part of the request
URL's path.

This fix makes removed the `mountPoint` prefix from the path so
proxied services receive requests as if they were running at the root
(`/`) path.

This could be an issue if the app generates URLs (in HTML or otherwise)
and assumes `/path`. In this case, those URLs will 404.

With that, I still think we should trim by default and not leak the
`mountPoint` (specific to Tailscale) into whatever app is hosted.
If it causes an issue with URL generation, I'd suggest looking at configuring
an app-specific path prefix or running Caddy as a more advanced
solution.

Fixes: #6571

Signed-off-by: Shayne Sweeney <shayne@tailscale.com>
2023-03-28 19:23:50 -04:00
..
testdata
c2n.go
cert.go
cert_js.go
cert_test.go
dnsconfig_test.go
expiry.go
expiry_test.go
local.go
local_test.go
loglines_test.go
network-lock.go
network-lock_test.go
peerapi.go sockstats: refactor validation to be opt-in 2023-03-09 14:31:20 -08:00
peerapi_h2c.go
peerapi_macios_ext.go
peerapi_test.go ipn/ipnlocal: drop not required StateKey parameter 2023-01-30 17:58:55 -08:00
profiles.go
profiles_test.go
serve.go
serve_test.go
ssh.go
ssh_stub.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
ssh_test.go
state_test.go