diff --git a/main.go b/main.go index 5cc4ecd3..7ca66dd3 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,7 @@ import ( "mime" "net/http" "os" + "strings" textTemplate "text/template" "time" ) @@ -145,6 +146,13 @@ func serve(host string, port uint64) { return s == config.Current.BuilderKey, nil }) + e.Pre(middleware.HTTPSRedirectWithConfig(middleware.RedirectConfig{ + Skipper: func(echo.Context) bool { + return !strings.HasPrefix(config.Current.PublicUrl, "https") + }, + Code: 302, + })) + e.GET("/", renderIndex, basicAuth) e.GET("/favicon.png", getFavIcon, basicAuth) e.POST("/apps", uploadUnsignedApp, basicAuth)