diff --git a/handler.go b/handler.go index 06ce07b..717ecf7 100644 --- a/handler.go +++ b/handler.go @@ -19,6 +19,9 @@ type Config struct { var config *Config +// httpClient is a shared HTTP client for all upstream requests +var httpClient = &http.Client{Timeout: 300 * time.Second} + // blockedHeaders are headers that should never be forwarded to upstream // for security/privacy reasons. These headers could leak internal URLs, // session information, or other sensitive data. @@ -218,8 +221,7 @@ func callUpstream(req *AnthropicRequest, apiKey, sessionID string) (*http.Respon httpReq.Header.Set(k, v) } - client := &http.Client{Timeout: 300 * time.Second} - return client.Do(httpReq) + return httpClient.Do(httpReq) } func writeError(w http.ResponseWriter, code int, message, errType, errCode string) { diff --git a/proxx b/proxx index 9d96b85..f8f727c 100755 Binary files a/proxx and b/proxx differ