gravitational/teleport · error
http.StatusText(code)
Error message
http.StatusText(code)
What it means
In the ALPN local proxy's response handling, the error/response writer emits the standard status text (e.g. 'Bad Gateway') for a mapped HTTP code when forwarding a request through the local proxy fails; the literal value is the reason phrase for the mapped status code.
Source
Thrown at lib/srv/alpnproxy/local_proxy.go:342
if errHeader != "" {
// TODO: find a cleaner way of formatting the error.
errHeader = strings.ReplaceAll(errHeader, " \t", "\n\t")
errHeader = strings.ReplaceAll(errHeader, " User Message:", "\n\n\tUser Message:")
l.cfg.Log.WarnContext(response.Request.Context(), "Server response contained an error header", "error_header", errHeader)
}
for _, infoHeader := range response.Header.Values(commonApp.TeleportAPIInfoHeader) {
l.cfg.Log.InfoContext(response.Request.Context(), "Server response info", "header", infoHeader)
}
if err := l.cfg.HTTPMiddleware.HandleResponse(response); err != nil {
return trace.Wrap(err)
}
return nil
},
ErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) {
l.cfg.Log.WarnContext(r.Context(), "Failed to handle request ", "error", err, "method", r.Method, "url", logutils.StringerAttr(r.URL))
code := trace.ErrorToCode(err)
http.Error(w, http.StatusText(code), code)
},
Transport: &http.Transport{
DialTLSContext: client.NewALPNDialer(l.getALPNDialerConfig(serverName, certs...)).DialContext,
},
}
}
// startHTTPAccessProxy starts the local HTTP access proxy.
func (l *LocalProxy) startHTTPAccessProxy(ctx context.Context) error {
if err := l.cfg.HTTPMiddleware.CheckAndSetDefaults(); err != nil {
return trace.Wrap(err)
}
l.cfg.Log.InfoContext(ctx, "Starting HTTP access proxy")
defer l.cfg.Log.InfoContext(ctx, "HTTP access proxy stopped")
server := &http.Server{
ReadHeaderTimeout: defaults.ReadHeadersTimeout,View on GitHub (pinned to 1283425b60)
Solutions
- Check tsh/local proxy logs for the underlying forwarding error
- Verify the target Teleport proxy address and credentials are valid
- Retry after re-authenticating if the error is auth-related
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at lib/srv/alpnproxy/local_proxy.go:342 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gravitational/teleport@1283425b60 (2026-09-02).
Data as JSON: /api/errors/936926d7661e07e2.
Report an issue: GitHub.