Server http and https on the same port using a customized server (#2247)

This commit is contained in:
Anis Elleuch
2016-07-24 21:30:57 +02:00
committed by Harshavardhana
parent 6c2fb19ed7
commit b0b919a1d6
2 changed files with 225 additions and 9 deletions

View File

@@ -91,15 +91,17 @@ type serverCmdConfig struct {
}
// configureServer configure a new server instance
func configureServer(srvCmdConfig serverCmdConfig) *http.Server {
func configureServer(srvCmdConfig serverCmdConfig) *MuxServer {
// Minio server config
apiServer := &http.Server{
Addr: srvCmdConfig.serverAddr,
// Adding timeout of 10 minutes for unresponsive client connections.
ReadTimeout: 10 * time.Minute,
WriteTimeout: 10 * time.Minute,
Handler: configureServerHandler(srvCmdConfig),
MaxHeaderBytes: 1 << 20,
apiServer := &MuxServer{
Server: http.Server{
Addr: srvCmdConfig.serverAddr,
// Adding timeout of 10 minutes for unresponsive client connections.
ReadTimeout: 10 * time.Minute,
WriteTimeout: 10 * time.Minute,
Handler: configureServerHandler(srvCmdConfig),
MaxHeaderBytes: 1 << 20,
},
}
// Returns configured HTTP server.
@@ -260,7 +262,7 @@ func serverMain(c *cli.Context) {
})
// Fetch endpoints which we are going to serve from.
endPoints := finalizeEndpoints(tls, apiServer)
endPoints := finalizeEndpoints(tls, &apiServer.Server)
// Prints the formatted startup message.
printStartupMessage(endPoints)