tailscale/ipn
shayne 7908b6d616
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-27 10:11:46 -04:00
..
ipnauth all: update copyright and license headers 2023-01-27 15:36:29 -08:00
ipnlocal ipn/ipnlocal: [serve] Trim mountPoint prefix from proxy path (#7334) 2023-03-27 10:11:46 -04:00
ipnserver logpolicy: split out DialContext into a func 2023-03-24 13:13:36 -07:00
ipnstate cmd/tailscale: surface node-key for locked out tailnet-lock peers 2023-03-09 11:06:23 -10:00
localapi all: pass log IDs as the proper type rather than strings 2023-03-23 11:26:55 -07:00
policy all: update copyright and license headers 2023-01-27 15:36:29 -08:00
store ipn/store/kubestore: handle "/" in ipn.StateKeys 2023-03-23 12:33:47 -07:00
backend.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
doc.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
fake_test.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
ipn_clone.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
ipn_view.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
prefs.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
prefs_test.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
serve.go all: replace /kb/ links with /s/ equivalents 2023-03-13 14:21:15 -07:00
serve_test.go ipn: add Funnel port check from nodeAttr 2023-03-11 11:20:52 -08:00
store.go ipn: remove unused NLKeyStateKey constant 2023-02-08 11:19:28 -08:00