Header

Header objects are used to add, modify, or delete headers from requests and responses. The header content can be simple strings or be derived from variables inside Varnish. Regular expressions can be used to customize the headers even further.

Data model

actionStringAccepts a string value, one of:.
setSets (or resets) a header.
appendAppends to an existing header.
deleteDelete a header.
regexPerform a single regex replacement on a header.
regex_repeatPerform a global regex replacement on a header.
cache_conditionStringOptional name of a CacheCondition to apply.
dstStringHeader to set.
ignore_if_setIntegerDon't add the header if it is added already. (Only applies to 'set' action).
nameStringA handle to refer to this Header object.
priorityIntegerLower priorities execute first. (Default: 100.).
regexStringRegular expression to use (Only applies to 'regex' and 'regex_repeat' actions).
request_conditionStringOptional name of a RequestCondition to apply.
response_conditionStringOptional name of a ResponseCondition to apply.
service_idStringThe alphanumeric string identifying a service.
srcStringVariable to be used as a source for the header content. (Does not apply to 'delete' action).
substitutionStringValue to substitute in place of regular expression. (Only applies to 'regex' and 'regex_repeat').
typeStringAccepts a string value, one of:.
requestPerforms on the request before lookup occurs.
fetchPerforms on the request to the origin server.
cachePerforms on the response before it's stored in the cache.
responsePerforms on the response before delivering to the client.
versionIntegerThe current version of a service.

Endpoints

List Header objects

GET/service/service_id/version/version/header

Get a Header object

GET/service/service_id/version/version/header/name

Create a Header object

POST/service/service_id/version/version/header

Update a Header object

PUT/service/service_id/version/version/header/old_name

Delete a Header object

DELETE/service/service_id/version/version/header/name

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.