Files
mattermost/docs
Eva Sarafianou 904ee27f26 docs: emit redirect stubs at both <from>/index.html and <from>.html (#38389)
active-redirects.json entries whose `from` lives outside the docs
CloudFront function's frozen legacy-Sphinx prefix set currently 404 in
production. The stub file exists in S3 at <from>/index.html but the CFF
(mattermost-iac-docs-prod -> 05-cdn -> clean-url-rewrite.js) only serves
that key for the frozen legacy prefixes; for any other first path
segment it falls back to <from>.html, which doesn't exist for
plugin-client-redirects stubs.

Add a postbuild step that duplicates every stub at the sibling flat
key. The legacy branch keeps hitting <from>/index.html unchanged; the
fallback branch now finds <from>.html. Real content pages are never
overwritten (the script skips any path where <from>.html already
exists), .html-suffixed from-values are skipped (CFF Phase A
canonicalizes them before Phase B routes them), and .. traversal in a
malformed from is rejected before any filesystem call.

Smoke-tested against a local build: 741 stubs duplicated, 0 real
content pages touched, byte-identical meta-refresh content.
2026-09-08 09:41:56 +03:00
..