Fix error in prepareServer

This commit is contained in:
Emile Vauge 2017-09-07 20:14:03 +02:00 committed by Traefiker
parent c19cce69fa
commit 3b6afdf80c
2 changed files with 4 additions and 3 deletions

View file

@ -647,6 +647,7 @@ func (server *Server) prepareServer(entryPointName string, entryPoint *configura
listener, err := net.Listen("tcp", entryPoint.Address)
if err != nil {
log.Error("Error opening listener ", err)
return nil, nil, err
}
if entryPoint.ProxyProtocol {

View file

@ -96,7 +96,7 @@ func TestPrepareServerTimeouts(t *testing.T) {
t.Parallel()
entryPointName := "http"
entryPoint := &configuration.EntryPoint{Address: "localhost:8080"}
entryPoint := &configuration.EntryPoint{Address: "localhost:0"}
router := middlewares.NewHandlerSwitcher(mux.NewRouter())
srv := NewServer(test.globalConfig)
@ -504,14 +504,14 @@ func TestServerEntrypointWhitelistConfig(t *testing.T) {
{
desc: "no whitelist middleware if no config on entrypoint",
entrypoint: &configuration.EntryPoint{
Address: ":8080",
Address: ":0",
},
wantMiddleware: false,
},
{
desc: "whitelist middleware should be added if configured on entrypoint",
entrypoint: &configuration.EntryPoint{
Address: ":8080",
Address: ":0",
WhitelistSourceRange: []string{
"127.0.0.1/32",
},