Response Headers
Last edit: Oct 26, 2022
Response Headers is a property to define your own custom response headers for the page. To do so, pass a JSON key-value pairs to response_headers
property, for example:
app/views/pages/xml-data.html.liquid
slug: xml-data
response_headers: >
{
"Content-Type": "text/xml",
"Some-Header": "value"
}
In the example above, endpoint /xml-data
will return it's content as XML, even though the file was saved as html
format. This allows you to have full control over returned headers. Liquid syntax is supported.
There are few restricted header names that cannot be overwritten:
- cache-control
- etag
- set-cookie
- x-request-id
- x-xss-protection