Repository navigation
fix(deploy): upload Markdown as text/markdown - #5112
Merged
Merged
Conversation
The AWS SDK has no .md entry in its MIME table, so .md pages were stored as application/octet-stream and CloudFront had to force text/markdown on every *.md response, error pages included. Upload them with an explicit text/markdown; charset=utf-8 type, through the same per-type staging directories as the spec files. SpecContentType becomes ExplicitContentType since it is no longer spec-only. Refs elastic/docs-eng-team#1231 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/5112/ |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of elastic/docs-eng-team#1231. Needed before elastic/docs-infra#537 can stop forcing
Content-Typeon*.mdresponses.Why
The AWS SDK guesses each upload's
Content-Typefrom its extension, and its table has no.mdentry, so every Markdown page is stored asapplication/octet-stream. To serve them correctly, CloudFront'sdocs-shared-markdownresponse-headers policy forcestext/markdownon every*.mdresponse. That includes error pages, so once the docs 404 page comes from Lambda@Edge (elastic/docs-infra#530), a missing.mdpage would be labeled as Markdown.Stored with the right type, CloudFront can serve
.mdresponses as they are. elastic/docs-infra#537 switches*.mdto a policy that adds headers only when missing, behindmarkdown_content_type_from_origin.What changes
.mduploads gettext/markdown; charset=utf-8, through the same per-type staging directories the spec files already use. The SDK shares one headers collection across a directory upload, so typed files never share one with other files.SpecContentTypeis renamedExplicitContentType, since it's no longer spec-only.Existing objects
The sync only uploads files whose content changed, so
.mdobjects already in the buckets keepapplication/octet-streamuntil they change. Beforemarkdown_content_type_from_originis turned on for an environment, its bucket needs a one-off in-place metadata rewrite:Testing
ExplicitContentTypeTestscovers.md, case-insensitive, along with the existing spec types, and checks that.txt,.html,.jsand an extensionlessmdstay untyped.Apply_SetsContentTypeOnTypedUploadschecks thatindex.mdgoes up in its owntext/markdowndirectory upload, separate from the untypedindex.html.Elastic.Documentation.Deploying.Testspass.🤖 Generated with Claude Code