Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
Hotfix/timeout settings (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbygdell authored Jan 27, 2023
2 parents 6a4b6a9 + 5d84010 commit 22e4480
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ func main() {

server := &http.Server{
Addr: ":8000",
ReadTimeout: 5 * time.Second,
WriteTimeout: 5 * time.Second,
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
IdleTimeout: 30 * time.Second,
ReadHeaderTimeout: 3 * time.Second,
ReadHeaderTimeout: 30 * time.Second,
}

if config.Server.cert != "" && config.Server.key != "" {
Expand Down
5 changes: 2 additions & 3 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const (
// NewProxy creates a new S3Proxy. This implements the ServerHTTP interface.
func NewProxy(s3conf S3Config, auth Authenticator, messenger Messenger, database *common.SDAdb, tls *tls.Config) *Proxy {
tr := &http.Transport{TLSClientConfig: tls}
client := &http.Client{Transport: tr}
client := &http.Client{Transport: tr, Timeout: 30 * time.Second}

return &Proxy{s3conf, auth, messenger, database, client, make(map[string]string)}
}
Expand Down Expand Up @@ -122,8 +122,7 @@ func (p *Proxy) allowedResponse(w http.ResponseWriter, r *http.Request) {
s3response, err := p.forwardToBackend(r)

if err != nil {
log.Debug("internal server error")
log.Debug(err)
log.Debugf("forwarding error: %v", err)
p.internalServerError(w, r)

return
Expand Down

0 comments on commit 22e4480

Please sign in to comment.