{"title":"Liquid header tag","slug":"liquid-header-tag","url":"https://support.storeconnect.com/articles/liquid-header-tag","url_markdown":"https://support.storeconnect.com/articles/liquid-header-tag.md","subtitle":null,"summary":"Set custom HTTP response headers from Liquid templates using the header tag. Works in layouts, page templates, snippets, and database content blocks.","type":"Developer_Documentation","video_url":"","keywords":"liquid header tag, HTTP response headers, header tag, Content-Security-Policy, X-Frame-Options, Referrer-Policy, liquid template, custom headers, theme headers, layout headers, page templates, snippets, database content blocks, response headers, CSP, Liquid tags, header name, header value","last_modified":"2026-08-21T07:12:35+0000","body_markdown":"The `header` Liquid tag sets HTTP response headers directly from your theme templates. When StoreConnect renders a page, it collects all headers set via this tag and includes them in the HTTP response sent to the browser.\n\n## Syntax\n\n\n```liquid\n\n{% header name: \"Header-Name\", value: \"header-value\" %}\n```\n\n\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `name` | Yes | The HTTP header name (e.g. `Content-Security-Policy`, `X-Custom-Header`) |\n| `value` | Yes | The header value |\n\n## Where you can use it\n\nThe `header` tag works in all of the following template contexts:\n\n- Layout templates (`layouts/`)\n- Page templates (`pages/`)\n- Snippets (`snippets/`) — including those rendered via `{% render %}`\n- Database content blocks (content stored in Salesforce)\n\nHeaders set in any of these contexts are merged together into the final HTTP response.\n\n## Examples\n\n### Set a Content-Security-Policy for one page\n\n\n```liquid\n\n{% if current_page.identifier == \"home\" %}\n  {% header name: \"Content-Security-Policy\", value: \"frame-ancestors 'self' example.com;\" %}\n{% endif %}\n```\n\n\n### Set a custom header from a layout\n\n\n```liquid\n\n{% header name: \"X-Store-Region\", value: current_store.name %}\n```\n\n\n### Set multiple headers\n\n\n```liquid\n\n{% header name: \"X-Frame-Options\", value: \"SAMEORIGIN\" %}\n{% header name: \"Referrer-Policy\", value: \"strict-origin-when-cross-origin\" %}\n```\n\n\nWhen multiple `header` tags set the same header name, the last value wins.\n\n## Notes\n\n- Some core platform headers (such as `Content-Type` and `Set-Cookie`) are controlled by StoreConnect and cannot be overridden with this tag.\n- Do not use this tag to expose sensitive information. Header values are visible to clients and intermediaries.\n- Dynamic values from Liquid variables are supported in both `name` and `value` parameters."}