Skip to content

Markdown redirects for moved docs pages 301 to the HTML URL instead of the markdown artifact #20594

Description

@CamSoper

Problem

When a docs page moves, scripts/make-s3-redirects.js creates S3 WebsiteRedirectLocation objects for the old URLs, including .md duplicates for markdown clients (the mdRedirects loop, lines 16–25). Those .md redirects point at the HTML URL of the new page rather than its markdown artifact, so a header-free markdown client (the .md URL-suffix convention, e.g. the Pulumi CLI docs fetcher) that follows the redirect lands on HTML.

Repro (production, 2026-07-30)

$ curl -sI https://www.pulumi.com/docs/iac/get-started/index.md | grep -iE "^HTTP/2|^location"
HTTP/2 301
location: https://www.pulumi.com/docs/get-started/          # ← HTML URL

$ curl -sIL https://www.pulumi.com/docs/iac/get-started/index.md | grep -iE "^HTTP/2|^content-type"
HTTP/2 301
HTTP/2 200
content-type: text/html; charset=utf-8                      # ← markdown URL dead-ends in HTML

The correct target already exists and serves markdown:

$ curl -sI https://www.pulumi.com/docs/get-started/index.md | grep -iE "^HTTP/2|^content-type"
HTTP/2 200
content-type: text/markdown; charset=utf-8

Scope notes

  • Header-based negotiation is unaffected: a client sending Accept: text/markdown keeps the header across the 301 and the destination negotiates correctly (verified: ends in 200 text/markdown). Only .md-suffix clients are impacted. Agent-readiness checkers that probe with the Accept header (e.g. Cloudflare's) are not affected either.
  • Pre-existing behavior; unrelated to (and not fixed by) Serve markdown for the homepage, /what-is/, /product/, and /pricing/ #20593, which extends markdown coverage to the homepage, /what-is/, /product/, and /pricing/.

Suggested fix

In the mdRedirects loop in scripts/make-s3-redirects.js: when duplicating a docs/**/*.html redirect to its .md key, rewrite the location to the markdown artifact (<target>index.md) whenever the target is a site-relative page URL (starts with /, ends with /). Leave external/absolute targets untouched.

While in there, consider widening the loop's key.startsWith("docs/") restriction to the sections that gain markdown artifacts in #20593 (what-is/, product/, pricing/, and the top-level aliases like get-started/ that target markdown-enabled pages), so moved pages in those sections get markdown-preserving .md redirects too.

Metadata

Metadata

Assignees

Labels

area/automationIssues relating to automation (mostly GHA workflows) and automatically generated contentarea/docs-contentIssues relating to content under pulumi.com/docs

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions