XTLS/Xray-core · error · errors.Error
failed to read http request
Error message
failed to read http request
What it means
Error "failed to read http request" thrown in XTLS/Xray-core.
Source
Thrown at proxy/http/server.go:118
inbound.CanSpliceCopy = 3
}
var reader *bufio.Reader
if len(firstbyte) > 0 {
readerWithoutFirstbyte := bufio.NewReaderSize(readerOnly{conn}, buf.Size)
multiReader := io.MultiReader(bytes.NewReader(firstbyte), readerWithoutFirstbyte)
reader = bufio.NewReaderSize(multiReader, buf.Size)
} else {
reader = bufio.NewReaderSize(readerOnly{conn}, buf.Size)
}
Start:
if err := conn.SetReadDeadline(time.Now().Add(s.policy().Timeouts.Handshake)); err != nil {
errors.LogInfoInner(ctx, err, "failed to set read deadline")
}
request, err := http.ReadRequest(reader)
if err != nil {
trace := errors.New("failed to read http request").Base(err)
if errors.Cause(err) != io.EOF && !isTimeout(errors.Cause(err)) {
trace.AtWarning()
}
return trace
}
if len(s.config.Accounts) > 0 {
user, pass, ok := parseBasicAuth(request.Header.Get("Proxy-Authorization"))
if !ok || !s.config.HasAccount(user, pass) {
return common.Error2(conn.Write([]byte("HTTP/1.1 407 Proxy Authentication Required\r\nProxy-Authenticate: Basic realm=\"proxy\"\r\n\r\n")))
}
if inbound != nil {
inbound.User.Email = user
}
}
errors.LogInfo(ctx, "request to Method [", request.Method, "] Host [", request.Host, "] with URL [", request.URL, "]")
if err := conn.SetReadDeadline(time.Time{}); err != nil {View on GitHub (pinned to 7d214f8b09)
When it happens
Trigger: Thrown at proxy/http/server.go:118 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/4a864cbc951cb726.
Report an issue: GitHub.