Skip to content

Commit

Permalink
start returning detailed auth errors to users
Browse files Browse the repository at this point in the history
  • Loading branch information
spikelu2016 committed Mar 20, 2024
1 parent 8e6ca27 commit d4b0e38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/server/web/proxy/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
Expand Down Expand Up @@ -288,7 +289,7 @@ func getMiddleware(cpm CustomProvidersManager, rm routeManager, pm PoliciesManag
if ok {
stats.Incr("bricksllm.proxy.get_middleware.authentication_error", nil, 1)
logError(log, "error when authenticating http requests", prod, cid, err)
JSON(c, http.StatusUnauthorized, "[BricksLLM] not authorized")
JSON(c, http.StatusUnauthorized, fmt.Sprintf("[BricksLLM] %v", err))
c.Abort()
return
}
Expand Down

0 comments on commit d4b0e38

Please sign in to comment.