Golang路线不起作用

I just started to get into golang and as I plan to host at least two websites, I chose to use Mux to display different routes by "filtering" domains. Whenever I try to access my main route, it just gives me an 404 error. (Also, the fact that the "www" part is absent is perfectly normal. I don't type that to access the site).

But if I launch the server as a file server, I can access my files, so the server in itself is working I guess

func redirect(w http.ResponseWriter, req *http.Request) {
    target := "https://" + req.Host + req.URL.Path
    http.Redirect(w, req, target,
        http.StatusTemporaryRedirect)
}

func main() {
    go http.ListenAndServe(":80", http.HandlerFunc(redirect)) // Redirection

    // Serveur sécurisé

    r := mux.NewRouter()
    r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("/root/go/src/web/static/"))))
    s := r.Host("echecderi.me").Subrouter()
    s.HandleFunc("/", indexEchec)

    http.ListenAndServeTLS(":443", "domain-crt.pem", "domain-key.pem", nil)
}

func indexEchec(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "<h1>Echec de rime</h1> </br> <img src=\"/static/echecderime/echec.gif\">")
}

I think you need to give r as the last parameter to http.ListenAndServeTLS.

you can also use a http.server instance

//create server instance
server := http.Server{
    Addr:      ":443",
    TLSConfig: tlsConfig(cert),
}

rtr := mux.NewRouter()
rtr.HandleFunc("/profile", HandlerProfile).Methods("GET")
//rtr.HandleFunc( other routes...

//pass mux handler to server
server.Handler = rtr
server.ListenAndServeTLS("", "")