feat[Https]: added https support (#113)
This commit is contained in:
1 parent
5d69b32119
commit
0177fb17b7
9 files changed
+89
-5
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/unrolled/secure"
|
||||
"go-admin/tools/config"
|
||||
)
|
||||
|
||||
func TlsHandler() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
secureMiddleware := secure.New(secure.Options{
|
||||
SSLRedirect: true,
|
||||
SSLHost: config.ApplicationConfig.Domain,
|
||||
})
|
||||
err := secureMiddleware.Process(c.Writer, c.Request)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user