enable redirect for http to https when certs provided
This commit is contained in:
parent
c22dc6e5fa
commit
99b10537ba
1 changed files with 12 additions and 6 deletions
|
@ -508,12 +508,18 @@ func server(c *cli.Context) error {
|
|||
|
||||
// start the server with tls enabled
|
||||
if c.String("server-cert") != "" {
|
||||
return http.ListenAndServeTLS(
|
||||
c.String("server-addr"),
|
||||
c.String("server-cert"),
|
||||
c.String("server-key"),
|
||||
handler,
|
||||
)
|
||||
g.Go(func() error {
|
||||
return http.ListenAndServe(":http", handler)
|
||||
})
|
||||
g.Go(func() error {
|
||||
return http.ListenAndServeTLS(
|
||||
":https",
|
||||
c.String("server-cert"),
|
||||
c.String("server-key"),
|
||||
handler,
|
||||
)
|
||||
})
|
||||
return g.Wait()
|
||||
}
|
||||
|
||||
// start the server without tls enabled
|
||||
|
|
Loading…
Reference in a new issue