fix: 解决启用 https 时无法访问的问题 (#2745)

pull/2750/head
ssongliu 1 year ago committed by GitHub
parent 000f175d97
commit 34ca984018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,7 +20,7 @@ import (
// @Router /websites/ssl/search [post] // @Router /websites/ssl/search [post]
func (b *BaseApi) PageWebsiteSSL(c *gin.Context) { func (b *BaseApi) PageWebsiteSSL(c *gin.Context) {
var req request.WebsiteSSLSearch var req request.WebsiteSSLSearch
if err := helper.CheckBindAndValidate(&req, c); err != nil { if err := helper.CheckBind(&req, c); err != nil {
return return
} }
if !reflect.DeepEqual(req.PageInfo, dto.PageInfo{}) { if !reflect.DeepEqual(req.PageInfo, dto.PageInfo{}) {

@ -4,7 +4,6 @@ import (
"crypto/tls" "crypto/tls"
"encoding/gob" "encoding/gob"
"fmt" "fmt"
"net"
"net/http" "net/http"
"os" "os"
"path" "path"
@ -71,16 +70,14 @@ func Start() {
server.TLSConfig = &tls.Config{ server.TLSConfig = &tls.Config{
Certificates: []tls.Certificate{cert}, Certificates: []tls.Certificate{cert},
} }
} global.LOG.Infof("listen at https://%s:%s [%s]", global.CONF.System.BindAddress, global.CONF.System.Port, tcpItem)
global.LOG.Infof("listen at %s:%s [%s]", global.CONF.System.BindAddress, global.CONF.System.Port, tcpItem) if err := server.ListenAndServeTLS("", ""); err != nil {
ln, err := net.Listen(tcpItem, global.CONF.System.BindAddress+":"+global.CONF.System.Port) panic(err)
if err != nil { }
panic(err) } else {
} global.LOG.Infof("listen at http://%s:%s [%s]", global.CONF.System.BindAddress, global.CONF.System.Port, tcpItem)
type tcpKeepAliveListener struct { if err := server.ListenAndServe(); err != nil {
*net.TCPListener panic(err)
} }
if err := server.Serve(tcpKeepAliveListener{ln.(*net.TCPListener)}); err != nil {
panic(err)
} }
} }

Loading…
Cancel
Save