Skip to content

Commit 87989e1

Browse files
committed
fix withTimeout ptoblem
1 parent 7ff1822 commit 87989e1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

main.go

+3
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ func (s *ProxyServer) handleRequest(w http.ResponseWriter, r *http.Request) {
416416
//outReq.Header.Set("Content-Type", "application/json")
417417

418418
resp, err := client.Client.Do(outReq)
419+
//resp, err := client.Client.Do(outReq.WithContext(r.Context()))
419420
if err != nil {
420421
log.Printf("Request to %s failed: %v", targetURL.String(), err)
421422
http.Error(w, "Failed to forward request", http.StatusBadGateway)
@@ -459,6 +460,8 @@ func main() {
459460
srv := &http.Server{
460461
Addr: ":3000",
461462
Handler: nil,
463+
ReadTimeout: 60 * time.Second, // Increase read timeout
464+
WriteTimeout: 60 * time.Second, // Increase write timeout
462465
}
463466

464467
go func() {

0 commit comments

Comments
 (0)