Skip to main content

render_page

Function render_page 

Source
pub fn render_page(config: &PageConfig<'_>) -> PageOutput
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. Serve them together with Cache-Control: no-store and never cache the HTML across requests — PageOutput::headers does that for you. 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.

A cache-aware caller should use render_page_with_nonce instead and re-stamp the shell per request.