I am trying to process a context timeout for each request. We have the following server structures:

Stream Overview:
Go server : basically acts as a [reverse proxy]. 2
Auth Server : Check for Authentication Requests.
Application Server : the logic for processing the main request.
Now, if the authorization server cannot process the request at the agreed time, I want to close goroutine from memory.
Here is what I tried:
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
req, _ := http.NewRequest("GET", authorizationServer, nil)
req.Header = r.Header
req.WithContext(ctx)
res, error := client.Do(req)
select {
case <-time.After(10 * time.Second):
fmt.Println("overslept")
case <-ctx.Done():
fmt.Println(ctx.Err())
}
" ", . . (goroutine), .
, 60 :
var netTransport = &http.Transport{
Dial: (&net.Dialer{
Timeout: 60 * time.Second,
}).Dial,
TLSHandshakeTimeout: 60 * time.Second,
}
client := &http.Client{
Timeout: time.Second * 60,
Transport: netTransport,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
- ? .
1. . - (goroutine), HTTP-, .