Skip to content

Commit

Permalink
Add option to configure default proxy timeout
Browse files Browse the repository at this point in the history
Should replace #976
  • Loading branch information
buger committed Aug 4, 2017
1 parent f5f297a commit e5c2165
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ type Config struct {
MaxIdleConnsPerHost int `bson:"max_idle_connections_per_host" json:"max_idle_connections_per_host"`
ReloadWaitTime int `bson:"reload_wait_time" json:"reload_wait_time"`
ProxySSLInsecureSkipVerify bool `json:"proxy_ssl_insecure_skip_verify"`
ProxyDefaultTimeout int `json:"proxy_default_timeout`
}

type CertData struct {
Expand Down
4 changes: 2 additions & 2 deletions reverse_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func (p *ReverseProxy) ServeHTTPForCache(rw http.ResponseWriter, req *http.Reque

func (p *ReverseProxy) CheckHardTimeoutEnforced(spec *APISpec, req *http.Request) (bool, int) {
if !spec.EnforcedTimeoutEnabled {
return false, 0
return false, globalConf.ProxyDefaultTimeout
}

_, versionPaths, _, _ := spec.Version(req)
Expand All @@ -380,7 +380,7 @@ func (p *ReverseProxy) CheckHardTimeoutEnforced(spec *APISpec, req *http.Request
return true, *intMeta
}

return false, 0
return false, globalConf.ProxyDefaultTimeout
}

func (p *ReverseProxy) CheckCircuitBreakerEnforced(spec *APISpec, req *http.Request) (bool, *ExtendedCircuitBreakerMeta) {
Expand Down

0 comments on commit e5c2165

Please sign in to comment.