A name for the server alone, such as a Tailscale Service, then opens it.
- commit
- dc8aac0ecb5a3da68342ad58ff1a00c869ed575f
- parent
- cbf3d1504187045f50d48d207adf5bd91480e7d6
- author
- FelineStateMachine <226808055+FelineStateMachine@users.noreply.github.com>
- kind
- feat risk score 1.5 of 3, Jev's estimate
| M | internal/ | 3 | +++ |
| M | internal/ | 6 | ++++-- |
@@ -286,6 +286,9 @@ func (s *Server) Handler() http.Handler {
286286 if s.TV != nil {287287 mux.Handle("GET /tv/", http.StripPrefix("/tv", tvFiles(s.TV)))288288 mux.Handle("GET /tv", http.RedirectHandler("/tv/", http.StatusFound))289+ // The server's own address leads to the TV app, as a name of its290+ // own (a Tailscale Service, say) would be expected to.291+ mux.Handle("GET /{$}", http.RedirectHandler("/tv/", http.StatusFound))289292 }290293 // For container health checks: up, without the token.291294 mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {@@ -39,8 +39,10 @@ func TestTV(t *testing.T) {
3939 return resp, string(body)4040 }4141 42- if resp, _ := get("/tv"); resp.StatusCode != http.StatusFound || resp.Header.Get("Location") != "/tv/" {43- t.Errorf("/tv: %d to %q", resp.StatusCode, resp.Header.Get("Location"))42+ for _, path := range []string{"/tv", "/"} {43+ if resp, _ := get(path); resp.StatusCode != http.StatusFound || resp.Header.Get("Location") != "/tv/" {44+ t.Errorf("%s: %d to %q", path, resp.StatusCode, resp.Header.Get("Location"))45+ }4446 }4547 resp, body := get("/tv/")4648 if resp.StatusCode != 200 || body != "<!doctype html><title>Airwaves</title>" {