How to use middleware.redirect?

Hi, I am trying to get a HTTPS server with redirection from HTTP and www to the HTTPS non WWW domain. The https://mydomain.com work but not the redirection from the https://www.mydomain.com , http://mydomain.com and http://www.mydomain.com. The https://www.mydomain.com shows the page but doesn’t redirect to https://mydomain.com. The HTTP requests just fail with www.mydomain.com refused to connect.Here is my code:
e := echo.New()
e.Pre(middleware.HTTPSRedirect())
e.Pre(middleware.HTTPSNonWWWRedirect())
serverstarted := e.StartTLS(":443",“cert.pem”,“privkey.pem”)
e.Logger.Fatal(serverstarted)
What am I missing?
Thanks

Is there also a redirect for HTTPS WWW > HTTPS non WWW?
httpS://www.labstack.com > httpS://labstack.com

the HTTPS NonWWW Redirect source is http not https

Thanks

Hi
I have the same issue here, with a very similar code.
HTTPSRedirect is just not redirecting.
Any progress?

Found the answer:
https://maciejmroz.com/2016/12/27/going-for-simplicity-with-go/

// redictHTTP starts a parallel server that monitors port 80 and redirects TLS
func redirectHTTP() {
e := echo.New()
e.Use(middleware.HTTPSRedirect())
go func() { e.Logger.Fatal(e.Start(":80")) }()
}

Start a separate server to redirect from 80 to 443.
Duh!