feat!: listen to both http & https (#4536)

Co-authored-by: Andy Hsu <i@nn.ci>
This commit is contained in:
BoYanZh
2023-06-10 22:26:09 +08:00
committed by Andy Hsu
parent 363e036bf0
commit f646d2a699
6 changed files with 79 additions and 29 deletions

View File

@ -21,6 +21,9 @@ func Init(e *gin.Engine) {
}
Cors(e)
g := e.Group(conf.URL.Path)
if conf.Conf.Scheme.Https && conf.Conf.Scheme.ForceHttps && !conf.Conf.Scheme.DisableHttp {
g.Use(middlewares.ForceHttps)
}
g.Any("/ping", func(c *gin.Context) {
c.String(200, "pong")
})