Skip to main content

render_page

Function render_page 

Source
pub fn render_page(config: &PageConfig<'_>) -> PageOutput
👎Deprecated since 0.2.2:

serves an empty shell with a 200 on any failure; use try_render, which returns the failure as a RenderError, and render_browser_shell for a route declared ssr: false. Removed in 3.0.0

Expand description

Render a page, generating a fresh CSP nonce for it.

The returned HTML and CSP header are ONE UNIT: the HTML embeds the nonce that only this policy blesses. Send the page with PageOutput::into_page_response, which writes Cache-Control: no-store, the policy and the document headers whenever the response is sent. Caching the HTML while regenerating the CSP kills every script on the page; caching both ships one static, publicly-known nonce to all users and defeats nonce-based CSP.

Deprecated: any load or walk failure here serves the empty Phase 1 shell with a 200 and a log line the handler never sees. Use crate::try_render, which returns the failure as a coded crate::RenderError, and crate::render_browser_shell for a route declared browser-rendered. This function keeps its fallback until 3.0.0 removes it, and in debug builds logs its deprecation once per process.