From c1bc623142e796277f48397cdcdc6364da627994 Mon Sep 17 00:00:00 2001 From: Tim Siegel Date: Sat, 21 Sep 2024 11:02:54 -0400 Subject: [PATCH] fix: redirect static-router/doc/master to stable docs (#568) --- .../release-distribution/lambdas/static-router/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/terragrunt/modules/release-distribution/lambdas/static-router/index.js b/terragrunt/modules/release-distribution/lambdas/static-router/index.js index d6ea17cc2..6ab00123d 100644 --- a/terragrunt/modules/release-distribution/lambdas/static-router/index.js +++ b/terragrunt/modules/release-distribution/lambdas/static-router/index.js @@ -35,5 +35,12 @@ 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')) { + return redirect('//doc.rust-lang.org/stable' + request.uri.slice(11), callback); + } + callback(null, request); };