File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ func main() {
1919 UserAgent : "https://github.com/alash3al/httpsify" ,
2020 }
2121
22+ httpChallengeHandler := e .AutoTLSManager .HTTPHandler (nil )
23+
2224 e .Use (middleware .HTTPSRedirect ())
2325 e .Use (middleware .Logger ())
2426 e .Use (middleware .Recover ())
@@ -27,12 +29,22 @@ func main() {
2729 if * flagSendXSecuredBy {
2830 c .Response ().Header ().Set ("X-Secured-By" , "https://github.com/alash3al/httpsify" )
2931 }
30- return next (c )
32+
33+ if ! c .IsTLS () {
34+ return echo .WrapHandler (httpChallengeHandler )(c )
35+ }
36+
37+ hosts := hosts .Load ().(map [string ]* echo.Echo )
38+ host := hosts [c .Request ().Host ]
39+
40+ if host == nil {
41+ return echo .ErrNotFound
42+ }
43+
44+ return echo .WrapHandler (host )(c )
3145 }
3246 })
3347
34- e .Any ("/*" , handler )
35-
3648 errChan := make (chan error )
3749
3850 go (func () {
You can’t perform that action at this time.
0 commit comments