Skip to content

Commit adbf9a5

Browse files
committed
updated main.go
1 parent cbd821b commit adbf9a5

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

main.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"log"
5+
"net/http"
56

67
"github.com/labstack/echo/v4"
78
"github.com/labstack/echo/v4/middleware"
@@ -19,9 +20,6 @@ func main() {
1920
UserAgent: "https://github.com/alash3al/httpsify",
2021
}
2122

22-
httpChallengeHandler := e.AutoTLSManager.HTTPHandler(nil)
23-
24-
e.Use(middleware.HTTPSRedirect())
2523
e.Use(middleware.Logger())
2624
e.Use(middleware.Recover())
2725
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
@@ -30,10 +28,6 @@ func main() {
3028
c.Response().Header().Set("X-Secured-By", "https://github.com/alash3al/httpsify")
3129
}
3230

33-
if !c.IsTLS() {
34-
return echo.WrapHandler(httpChallengeHandler)(c)
35-
}
36-
3731
hosts := hosts.Load().(map[string]*echo.Echo)
3832
host := hosts[c.Request().Host]
3933

@@ -48,7 +42,7 @@ func main() {
4842
errChan := make(chan error)
4943

5044
go (func() {
51-
errChan <- e.Start(*flagHTTPAddr)
45+
errChan <- http.ListenAndServe(*flagHTTPAddr, e.AutoTLSManager.HTTPHandler(nil))
5246
})()
5347

5448
go (func() {

0 commit comments

Comments
 (0)