Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
Logging & Keepalive (#321)
Browse files Browse the repository at this point in the history
- making the upstream keepalive default to true
- fixing a small logging
  • Loading branch information
gambol99 committed Mar 2, 2018
1 parent 57736a4 commit 97c0895
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ FEATURES:
* Added the ability to control the timeout on the initial openid configuration from .well-known/openid-configuration [#PR315](https://github.com/gambol99/keycloak-proxy/pull/315)
* Updated to Golang version 1.10 [#PR316](https://github.com/gambol99/keycloak-proxy/pull/316)
* Added the X-Auth-Audience to the upstream headers [#PR319](https://github.com/gambol99/keycloak-proxy/pull/319)
* Changed the upstream-keepalive to default to true [#PR321](https://github.com/gambol99/keycloak-proxy/pull/321)

#### **2.1.1**

Expand Down
3 changes: 2 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func newDefaultConfig() *Config {
AccessTokenDuration: time.Duration(720) * time.Hour,
CookieAccessName: "kc-access",
CookieRefreshName: "kc-state",
EnableAuthorizationHeader: true,
EnableAuthorizationCookies: true,
EnableAuthorizationHeader: true,
EnableTokenHeader: true,
Headers: make(map[string]string),
LetsEncryptCacheDir: "./cache/",
Expand All @@ -46,6 +46,7 @@ func newDefaultConfig() *Config {
Tags: make(map[string]string, 0),
UpstreamExpectContinueTimeout: 10 * time.Second,
UpstreamKeepaliveTimeout: 10 * time.Second,
UpstreamKeepalives: true,
UpstreamResponseHeaderTimeout: 1 * time.Second,
UpstreamTLSHandshakeTimeout: 10 * time.Second,
UpstreamTimeout: 10 * time.Second,
Expand Down
10 changes: 3 additions & 7 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,7 @@ func (r *oauthProxy) createHTTPListener(config listenerConfig) (net.Listener, er

getCertificate = m.GetCertificate
} else {
r.log.Info("tls support enabled",
zap.String("certificate", config.certificate), zap.String("private_key", config.privateKey))
r.log.Info("tls support enabled", zap.String("certificate", config.certificate), zap.String("private_key", config.privateKey))
// creating a certificate rotation
rotate, err := newCertificateRotator(config.certificate, config.privateKey, r.log)
if err != nil {
Expand Down Expand Up @@ -552,8 +551,8 @@ func (r *oauthProxy) createUpstreamProxy(upstream *url.URL) error {
proxy.Logger = httplog.New(ioutil.Discard, "", 0)
r.upstream = proxy

// create the http transport
tp := &http.Transport{
// update the tls configuration of the reverse proxy
r.upstream.(*goproxy.ProxyHttpServer).Tr = &http.Transport{
Dial: dialer,
DisableKeepAlives: !r.config.UpstreamKeepalives,
ExpectContinueTimeout: r.config.UpstreamExpectContinueTimeout,
Expand All @@ -562,9 +561,6 @@ func (r *oauthProxy) createUpstreamProxy(upstream *url.URL) error {
TLSHandshakeTimeout: r.config.UpstreamTLSHandshakeTimeout,
}

// update the tls configuration of the reverse proxy
r.upstream.(*goproxy.ProxyHttpServer).Tr = tp

return nil
}

Expand Down

0 comments on commit 97c0895

Please sign in to comment.