cmd/relui: redirect to base URL after creating a workflow

Also update the suggested command in README to serve over HTTP locally.
(This is needed now that relui uses x/build/internal/https for serving.)

Fixes golang/go#51466.

Change-Id: Iaf0e0b62f3cd6015c793a0a16cff895be5ea42b4
Reviewed-on: https://go-review.googlesource.com/c/build/+/401796
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/cmd/relui/README.md b/cmd/relui/README.md
index ec92780..e1577c7 100644
--- a/cmd/relui/README.md
+++ b/cmd/relui/README.md
@@ -17,7 +17,7 @@
 set.
 
 ```bash
-PGHOST=localhost PGDATABASE=relui-dev PGUSER=postgres go run ./
+PGHOST=localhost PGDATABASE=relui-dev PGUSER=postgres go run . -listen-http=localhost:8080
 ```
 
 Alternatively, using docker:
diff --git a/internal/relui/web.go b/internal/relui/web.go
index c491ee0..fa290f6 100644
--- a/internal/relui/web.go
+++ b/internal/relui/web.go
@@ -54,7 +54,7 @@
 	db      *pgxpool.Pool
 	m       *http.ServeMux
 	w       *Worker
-	baseURL *url.URL
+	baseURL *url.URL // nil means "/".
 	header  SiteHeader
 	// mux used if baseURL is set
 	bm *http.ServeMux
@@ -65,6 +65,8 @@
 
 // NewServer initializes a server with the provided connection pool,
 // worker, base URL and site header.
+//
+// The base URL may be nil, which is the same as "/".
 func NewServer(p *pgxpool.Pool, w *Worker, baseURL *url.URL, header SiteHeader) *Server {
 	s := &Server{
 		db:      p,
@@ -234,5 +236,5 @@
 		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
 		return
 	}
-	http.Redirect(w, r, "/", http.StatusSeeOther)
+	http.Redirect(w, r, s.BaseLink("/"), http.StatusSeeOther)
 }