From 5c5891ff8321d883e7628bec1ff48659d533b024 Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Thu, 23 Jul 2026 12:37:11 +0000 Subject: [PATCH] docs: redirect bare Learn path --- data/redirects.yml | 2 ++ hack/releaser/cloudfront-lambda-redirects.js | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/data/redirects.yml b/data/redirects.yml index bb8112e92e80..8588f46720c6 100644 --- a/data/redirects.yml +++ b/data/redirects.yml @@ -8,6 +8,8 @@ # provide a short, permanent link to refer to a topic in the documentation. # For example, the docker CLI can output https://docs.docker.com/go/some-topic # in its help output, which can be redirected to elsewhere in the documentation. +"/learn/": + - /learn "/security/access-tokens/": - /go/access-tokens/ "/reference/api/engine/#deprecated-api-versions": diff --git a/hack/releaser/cloudfront-lambda-redirects.js b/hack/releaser/cloudfront-lambda-redirects.js index 6fbc40e5b182..0d0c472ed48d 100644 --- a/hack/releaser/cloudfront-lambda-redirects.js +++ b/hack/releaser/cloudfront-lambda-redirects.js @@ -8,7 +8,12 @@ exports.handler = (event, context, callback) => { const redirects = JSON.parse(`{{.RedirectsJSON}}`); for (let key in redirects) { const redirectTarget = key.replace(/\/$/, "") - if (redirectTarget !== requestUrl) { + const exactMatch = key === request.uri + // Preserve slash-insensitive matching without redirecting a canonical + // slash-terminated destination back to itself. + const normalizedMatch = redirectTarget === requestUrl && + redirects[key] !== request.uri + if (!exactMatch && !normalizedMatch) { continue; } //console.log(`redirect: ${requestUrl} to ${redirects[key]}`);