From 767967c3499795e3141e74cace5ae3d70f27cf61 Mon Sep 17 00:00:00 2001
From: Rohith <gambol99@gmail.com>
Date: Thu, 18 May 2017 17:47:31 +0100
Subject: [PATCH] Proxy Protocol

- porting the fix to the proxy protocol
---
 doc.go    |  2 +-
 server.go | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/doc.go b/doc.go
index 47cd03d..22dfc4a 100644
--- a/doc.go
+++ b/doc.go
@@ -24,7 +24,7 @@ import (
 )
 
 var (
-	release = "v2.0.4"
+	release = "v2.0.7"
 	gitsha  = "no gitsha provided"
 	version = release + " (git+sha: " + gitsha + ")"
 )
diff --git a/server.go b/server.go
index 309bd9e..4aea1f7 100644
--- a/server.go
+++ b/server.go
@@ -379,6 +379,12 @@ func createHTTPListener(config listenerConfig) (net.Listener, error) {
 		}
 	}
 
+	// step: does it require proxy protocol?
+	if config.proxyProtocol {
+		log.Infof("enabling the proxy protocol on listener: %s", config.listen)
+		listener = &proxyproto.Listener{Listener: listener}
+	}
+
 	// step: does the socket require TLS?
 	if config.certificate != "" && config.privateKey != "" {
 		log.Infof("tls enabled, certificate: %s, key: %s", config.certificate, config.privateKey)
@@ -410,12 +416,6 @@ func createHTTPListener(config listenerConfig) (net.Listener, error) {
 		}
 	}
 
-	// step: does it require proxy protocol?
-	if config.proxyProtocol {
-		log.Infof("enabling the proxy protocol on listener: %s", config.listen)
-		listener = &proxyproto.Listener{Listener: listener}
-	}
-
 	return listener, nil
 }
 
-- 
GitLab