Skip to content

Commit 7917da1

Browse files
committed
golink: use http.StatusFound for redirects
If users belong to multiple tailnets with golinks deployed (as is common) then permanent redirects for one will conflict with the others. To prevent this we will use `http.StatusFound` to prompt browsers to continue to visit the `go/` URL in the future. Signed-off-by: Patrick O'Doherty <[email protected]>
1 parent 5e70935 commit 7917da1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

golink.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func deleteLinkStats(link *Link) {
329329
// requests. It redirects all requests to the HTTPs version of the same URL.
330330
func redirectHandler(hostname string) http.Handler {
331331
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
332-
http.Redirect(w, r, (&url.URL{Scheme: "https", Host: hostname, Path: r.URL.Path}).String(), http.StatusMovedPermanently)
332+
http.Redirect(w, r, (&url.URL{Scheme: "https", Host: hostname, Path: r.URL.Path}).String(), http.StatusFound)
333333
})
334334
}
335335

0 commit comments

Comments
 (0)