feat: track upstream request ID and prevent response header override
When proxying through another new-api instance, the upstream X-Oneapi-Request-Id was overwriting the local one in client responses. This adds a new `upstream_request_id` field to the logs table, captures the upstream ID during relay, and filters it from being copied back to the client. Frontend gains search/filter and detail display support.
This commit is contained in:
@@ -524,6 +524,10 @@ func doRequest(c *gin.Context, req *http.Request, info *common.RelayInfo) (*http
|
||||
return nil, errors.New("resp is nil")
|
||||
}
|
||||
|
||||
if upID := resp.Header.Get(common2.RequestIdKey); upID != "" {
|
||||
c.Set(common2.UpstreamRequestIdKey, upID)
|
||||
}
|
||||
|
||||
_ = req.Body.Close()
|
||||
_ = c.Request.Body.Close()
|
||||
return resp, nil
|
||||
|
||||
Reference in New Issue
Block a user