Skip to content

Commit

Permalink
fix: redirect static-router/doc/master to stable docs (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
softmoth committed Sep 24, 2024
1 parent ca5e95c commit 2936de8
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,16 @@ echo " curl https://sh.rustup.rs -sSf | sh"
return redirect('https://sh.rustup.rs', body, callback);
}

// Links to `/doc/master/*` are probably from old external sources, so send
// them back through the doc site to take advantage of any helpful error
// handling that may be defined there
if (request.uri.startsWith('/doc/master')) {
// The slice method is used to remove the '/doc/master' prefix from the
// URI. 11 is the length of '/doc/master'.
const newUri = 'https://doc.rust-lang.org/stable' + request.uri.slice(11);
const body = "The documentation now lives under doc.rust-lang.org";
return redirect(newUri, body, callback);
}

callback(null, request);
};

0 comments on commit 2936de8

Please sign in to comment.