Skip to content

Commit a84fb63

Browse files
author
Jose Diaz-Gonzalez
committed
feat: redirect dokku docs to dokku.com
The new domain continues to use a (forked) version of viewdocs, though customized to properly handle the new routing setup for the dokku.com domain name.
1 parent 1f60f85 commit a84fb63

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

viewdocs.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,13 @@ func handleRedirects(w http.ResponseWriter, r *http.Request, config map[string]i
398398
if r.RequestURI == "/" {
399399
redirectTo = "http://progrium.viewdocs.io/viewdocs/"
400400
}
401-
if strings.Contains(r.Host, "progrium") && strings.HasPrefix(r.RequestURI, "/dokku") {
402-
redirectTo = "http://dokku.viewdocs.io" + r.RequestURI
401+
if strings.Contains(r.Host, "progrium") || strings.Contains(r.Host, "dokku") {
402+
if r.RequestURI == "/dokku" || r.RequestURI == "/dokku/" {
403+
redirectTo = "https://dokku.com"
404+
}
405+
if strings.HasPrefix(r.RequestURI, "/dokku") {
406+
redirectTo = "https://dokku.com" + "/docs" + strings.TrimPrefix(r.RequestURI, "/dokku")
407+
}
403408
}
404409
if isAsset(doc) && !strings.Contains(r.Header.Get("Cache-Control"), "no-store") {
405410
redirectTo = "https://cdn.jsdelivr.net/gh/" + user + "/" + repo + "@" + ref + "/docs/" + doc

0 commit comments

Comments
 (0)