Docly Developers
Function API only Updated 23 Oct 2026

setHeader(name, value)

Sets a header value in the response.

Parameters

namestringrequired

The name of the header to set.

valuestringrequired

The value to set for the header.

Returns

Nothing. Throws if the name is empty.

Headers set here are applied last, so they override headers Docly sets itself, such as Cache-Control. Setting the same name twice keeps the last value.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
// Set a custom header in the response
docly.setHeader("X-Custom-Header", "CustomValue");