{"record":{"id":"936926d7661e07e2","repo":"gravitational/teleport","slug":"http-statustext-code","errorCode":null,"errorMessage":"http.StatusText(code)","messagePattern":"http\\.StatusText\\(code\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/srv/alpnproxy/local_proxy.go","lineNumber":342,"sourceCode":"\t\t\tif errHeader != \"\" {\n\t\t\t\t// TODO: find a cleaner way of formatting the error.\n\t\t\t\terrHeader = strings.ReplaceAll(errHeader, \" \\t\", \"\\n\\t\")\n\t\t\t\terrHeader = strings.ReplaceAll(errHeader, \" User Message:\", \"\\n\\n\\tUser Message:\")\n\t\t\t\tl.cfg.Log.WarnContext(response.Request.Context(), \"Server response contained an error header\", \"error_header\", errHeader)\n\t\t\t}\n\t\t\tfor _, infoHeader := range response.Header.Values(commonApp.TeleportAPIInfoHeader) {\n\t\t\t\tl.cfg.Log.InfoContext(response.Request.Context(), \"Server response info\", \"header\", infoHeader)\n\t\t\t}\n\n\t\t\tif err := l.cfg.HTTPMiddleware.HandleResponse(response); err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\tErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) {\n\t\t\tl.cfg.Log.WarnContext(r.Context(), \"Failed to handle request \", \"error\", err, \"method\", r.Method, \"url\", logutils.StringerAttr(r.URL))\n\t\t\tcode := trace.ErrorToCode(err)\n\t\t\thttp.Error(w, http.StatusText(code), code)\n\t\t},\n\t\tTransport: &http.Transport{\n\t\t\tDialTLSContext: client.NewALPNDialer(l.getALPNDialerConfig(serverName, certs...)).DialContext,\n\t\t},\n\t}\n}\n\n// startHTTPAccessProxy starts the local HTTP access proxy.\nfunc (l *LocalProxy) startHTTPAccessProxy(ctx context.Context) error {\n\tif err := l.cfg.HTTPMiddleware.CheckAndSetDefaults(); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tl.cfg.Log.InfoContext(ctx, \"Starting HTTP access proxy\")\n\tdefer l.cfg.Log.InfoContext(ctx, \"HTTP access proxy stopped\")\n\n\tserver := &http.Server{\n\t\tReadHeaderTimeout: defaults.ReadHeadersTimeout,","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/lib/srv/alpnproxy/local_proxy.go#L324-L360","documentation":"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.","triggerScenarios":"Thrown at lib/srv/alpnproxy/local_proxy.go:342 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}