Skip to content

docs: clarify HTTP header setting from layouts - #14540

Closed
sharadvc wants to merge 1 commit into
withastro:mainfrom
sharadvc:cursor/clarify-layout-http-headers-7f06
Closed

sharadvc wants to merge 1 commit into
withastro:mainfrom
sharadvc:cursor/clarify-layout-http-headers-7f06

Conversation

@sharadvc

Copy link
Copy Markdown

Summary

The on-demand rendering caution said HTTP headers could only be set at the page level, not in layouts. That was too strict.

On on-demand routes, Astro.response.headers set from layouts and nested .astro components does reach the response if set before the body streams. Prerendered pages still ignore custom headers, and late/async updates after streaming starts may not apply.

Fixes #11843

@astrobot-houston

Copy link
Copy Markdown
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/on-demand-rendering.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@ArmandPhilippot

Copy link
Copy Markdown
Member

See #14541 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Seems like Layouts CAN set HTTP response headers, contrary to the docs?

3 participants