<cfheader>

Generates custom HTTP response headers to return to the client.

If <cfflush> has been used, this will throw an error.

You can detect if a page has already been flushed using

getPageContext().getHttpServletResponse().isCommitted();

This tag may have a body.

This tag is also supported within <cfscript>

<cfheader name=string value=string statuscode=number charset=string statustext=string ><!--- body --->[</cfheader>]
Attribute Description
name
string, optional

A name for the header.

value
string, optional

A value for the HTTP header. This attribute is used in conjunction with the name attribute.

statuscode
number, optional

A number that sets the HTTP status code.

charset
string, optional

The character encoding in which to encode the header value.

For more information on character encodings, see: https://www.w3.org/International/questions/qa-html-encoding-declarations.

statustext
string, optional

Text that explains the status code. This attribute is used in conjunction with the statusCode attribute.

Examples

<cfheader name="Content-Type" value="application/json">

See also