refresh bad urls to git.wit.org

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-12 17:38:05 -06:00
parent 96cd3c3524
commit 46959efd7b
3 changed files with 28 additions and 2 deletions

9
files/refresh.html Normal file
View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=https://go.wit.com/">
</head>
<body>
BAD URL <a href="https://go.wit.com/">redirecting back to go.wit.com</a>
</body>
</html>

View File

@ -24,6 +24,7 @@ go.wit.com/apps/go.wit.com git.wit.org/jcarr/go.wit.com
# Support packages
go.wit.com/dev/alexflint/go-arg/ git.wit.org/wit/go-arg
go.wit.com/arg git.wit.org/wit/arg
go.wit.com/dev/alexflint/go-arg git.wit.org/wit/arg
go.wit.com/shell git.wit.org/wit/shell
go.wit.com/spew github.com/wit-go/spew

18
main.go
View File

@ -54,7 +54,8 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
return
}
log.Warn("BAD URL =", url, "REPO URL =", repourl)
fmt.Fprintln(w, "BAD", tmp)
badurl(w, r.URL.String())
// fmt.Fprintln(w, "BAD", tmp)
}
func findFile(w http.ResponseWriter, filename string) {
@ -96,3 +97,18 @@ func main() {
log.Println("Error starting server:", err)
}
}
func badurl(w http.ResponseWriter, badurl string) {
fmt.Fprintln(w, "<!DOCTYPE html>")
fmt.Fprintln(w, "<html>")
fmt.Fprintln(w, " <head>")
fmt.Fprintln(w, " <meta http-equiv=\"refresh\" content=\"3; url=https://go.wit.com/\">")
fmt.Fprintln(w, " </head>")
fmt.Fprintln(w, " <body>")
fmt.Fprintln(w, " IPv4 IS NOT SUPPORTED<br>")
fmt.Fprintln(w, " MANY OF THESE REPOS REQUIRE IPv6.<br>")
fmt.Fprintln(w, " <br>")
fmt.Fprintln(w, " bad url", badurl, "<a href=\"https://git.wit.org/\">redirecting</a>")
fmt.Fprintln(w, " </body>")
fmt.Fprintln(w, "</html>")
}