diff --git a/internal/client/tcp/pool_handler.go b/internal/client/tcp/pool_handler.go index 8056ee8..ff56db0 100644 --- a/internal/client/tcp/pool_handler.go +++ b/internal/client/tcp/pool_handler.go @@ -117,7 +117,7 @@ func (c *PoolClient) handleHTTPStream(stream net.Conn) { resp, err := c.httpClient.Do(outReq) if err != nil { - httputil.WriteProxyError(cc, http.StatusBadGateway, "Local service unavailable") + httputil.WriteLocalServiceUnavailable(cc, c.localPort) return } defer resp.Body.Close() diff --git a/internal/shared/httputil/helpers.go b/internal/shared/httputil/helpers.go index 5c92c70..d0644b7 100644 --- a/internal/shared/httputil/helpers.go +++ b/internal/shared/httputil/helpers.go @@ -64,6 +64,94 @@ func WriteProxyError(w io.Writer, code int, msg string) { _ = resp.Body.Close() } +func WriteLocalServiceUnavailable(w io.Writer, localPort int) { + html := fmt.Sprintf(` + +
+ + +The tunnel is active, but the local service is not responding.
+This could happen because:
+%dPlease ensure your local service is running on port %d and try again.