lets encrypt: migrate to http-01 challenge
This commit is contained in:
parent
5ba8cc3863
commit
32e80eca20
1 changed files with 14 additions and 15 deletions
|
@ -576,24 +576,23 @@ func server(c *cli.Context) error {
|
|||
|
||||
// start the server with lets encrypt enabled
|
||||
// listen on ports 443 and 80
|
||||
address, err := url.Parse(c.String("server-host"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dir := cacheDir()
|
||||
os.MkdirAll(dir, 0700)
|
||||
|
||||
manager := autocert.Manager{
|
||||
Prompt: autocert.AcceptTOS,
|
||||
HostPolicy: autocert.HostWhitelist(address.Host),
|
||||
Cache: autocert.DirCache(dir),
|
||||
}
|
||||
g.Go(func() error {
|
||||
return http.ListenAndServe(":http", http.HandlerFunc(redirect))
|
||||
return http.ListenAndServe(":http", manager.HTTPHandler(http.HandlerFunc(redirect)))
|
||||
})
|
||||
|
||||
g.Go(func() error {
|
||||
address, err := url.Parse(c.String("server-host"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dir := cacheDir()
|
||||
os.MkdirAll(dir, 0700)
|
||||
|
||||
manager := autocert.Manager{
|
||||
Prompt: autocert.AcceptTOS,
|
||||
HostPolicy: autocert.HostWhitelist(address.Host),
|
||||
Cache: autocert.DirCache(dir),
|
||||
}
|
||||
serve := &http.Server{
|
||||
Addr: ":https",
|
||||
Handler: handler,
|
||||
|
|
Loading…
Reference in a new issue