Varnish Logo

API Configuration Reference

Complete reference for the configuration JSON format used by the wizard API endpoints.

This page documents the JSON format used when reading or writing configuration via the wizard API (/wizard/core endpoints). Every field that appears in the UI wizard corresponds to a key in this format except for domains and origins which are managed on their own endpoints.

Duration strings

Fields marked as duration accept duration strings, composed of a number and a unit suffix:

SuffixUnit
msmilliseconds
sseconds
mminutes
hhours
ddays
wweeks
yyears

Examples: "10s", "5m".

Top-level structure

{
  "general": { },
  "highAvailability": { },
  "queryParams": { },
  "headers": { },
  "cookies": { },
  "security": { },
  "optimisation": { },
  "overrides": [ ]
}

highAvailability and optimisation are optional — they are omitted entirely when the corresponding features are disabled.


general

FieldTypeRequiredNotes
allowMethods[]stringyesAllowed HTTP methods. Values: "GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "CONNECT", "OPTIONS", "TRACE"
uncacheableboolyesDisable caching entirely for this rule
cacheableTTLOverridestring (duration)noOverride TTL for cacheable responses. Omitted when not set
errorCodeTTLOverridestring (duration)noOverride TTL for error-code responses. Omitted when not set
uncacheableTTLstring (duration)yesHow long edge nodes remember that a response is uncacheable
firstByteTimeoutstring (duration)yesHow long to wait for the first response byte from origin. Default "10s"
websocketstringyes"disable" | "enable" | "exclusive"
allowBodyWithGetboolyesAllow GET requests that include a request body
urlDecodeReservedstringyes"enabled" | "disabled"
maxReqBodySizestring (bytes)yesMaximum request body size, e.g. "10m" for 10 MB
chunkedBody.actionstringyes"deny" | "allow" | "cache"
shardingobjectnoOmitted when sharding is disabled
sharding.hashSourcestring—"url" | "client_ip"
backendRetryboolyesRetry with a different origin on 5xx responses
urlRewritestringnoURL path to rewrite the request to, starting with /, e.g. "/index.html". Omitted when URL rewriting is disabled

highAvailability

This key is optional — it is omitted entirely when no high-availability features are enabled.

FieldTypeRequiredNotes
staleIfErrorobjectnoOmitted when stale-if-error is disabled
staleIfError.keepStaleDurationstring (duration)yesHow long to serve stale content while the origin is unavailable
staleIfError.staleReviveobjectnoOmitted when stale-revive is disabled
staleIfError.staleRevive.ttlstring (duration)yesHow long to serve a background-refreshed stale object
staleIfError.staleRevive.gracestring (duration)yesExtra time an object can be served stale during background refresh

queryParams

FieldTypeRequiredNotes
removeQueryParameters.actionstringyes"off" | "redirect" | "continue" | "sort"

Action values:

  • "off" — Query parameters are passed through unchanged with no processing.
  • "redirect" — Strip all query parameters and redirect the client to the cleaned URL.
  • "continue" — Strip all query parameters and continue serving from the cleaned URL without redirecting.
  • "sort" — Sort query parameters alphabetically to improve cache hit rates.

headers

FieldTypeRequiredNotes
onAuthHeader.actionstringyes"remove" | "pass"
unsetHeadersForDelivery[]stringyesResponse headers to strip before delivery to the client. Max 5 entries
hashHeaders[]stringyesRequest headers to include in the cache key. Max 5 entries
setBackendHeaders[]{name, value}yesHeaders to add to requests sent to the origin. Max 5 entries
setHeadersForDelivery[]{name, value}yesHeaders to add to responses delivered to the client. Max 5 entries
trueClientIpboolyesForward the original client IP as True-Client-IP to the origin

cookies

cookies.onCookie

Controls how incoming request cookies are handled. Exactly one of action or allowList is present — they are mutually exclusive.

FieldTypeNotes
actionstring"pass" — pass all cookies to the origin. "remove" — strip all cookies. Mutually exclusive with allowList
allowList[]stringCookie names to keep; all others are stripped. Max 5 entries. Mutually exclusive with action

cookies.onSetCookie

Controls how Set-Cookie response headers from the origin are handled. Exactly one of action, allowList, or denyList is present.

FieldTypeNotes
actionstring"pass" — pass all Set-Cookie headers to the client. "remove" — strip all Set-Cookie headers. Mutually exclusive with allowList and denyList
allowList[]stringCookie names whose Set-Cookie headers are kept; all others are stripped. Mutually exclusive with action and denyList
denyList[]stringCookie names whose Set-Cookie headers are stripped; all others pass through. Mutually exclusive with action and allowList

security

FieldTypeRequiredNotes
httpsRedirectboolyesRedirect HTTP requests to HTTPS
hstsboolyesAdd the Strict-Transport-Security header
botVerifySettingsstringyes"disabled" | "enabled"
hotlinkProtectionobjectnoOmitted when hotlink protection is disabled
hotlinkProtection.friends[]stringyesHostnames permitted to embed your resources
asnFilterobjectnoOmitted when ASN filtering is disabled
asnFilter.allowVerifiedBotsboolyesAllow verified search engine bots through the ASN filter
asnFilter.actionstringyesHTTP status code returned for blocked requests: "403" | "404" | "429"
asnFilter.typestringyes"country_deny_list" | "country_allow_list" | "asn_deny_list" | "asn_allow_list". Determines which of the four list fields below is present
asnFilter.countryDenyList[]stringnoTwo-letter country codes to block. Mutually exclusive with the other three list fields
asnFilter.countryAllowList[]stringnoOnly allow traffic from these countries. Mutually exclusive with the other three list fields
asnFilter.asnDenyList[]stringnoASN numbers to block. Mutually exclusive with the other three list fields
asnFilter.asnAllowList[]stringnoOnly allow traffic from these ASNs. Mutually exclusive with the other three list fields
botProtectionobjectnoOmitted when standard bot protection is disabled
botProtection.modestringyes"captcha" | "pow" | "both". Default "both"
botProtection.captchaTtlstring (duration)noHow long a visitor stays cleared after solving the Captcha challenge. Default "1h". Present only when botProtection.mode is "captcha" or "both"
wafobjectnoOmitted when WAF is disabled
waf.modestringyes"detect" — log only, do not block. "deny" — block matching requests
waf.owaspboolyesEnable the OWASP Core Rule Set
waf.atomicboolyesEnable the Atomicorp advanced rule set
waf.skipRuleId[]stringyesRule IDs to exempt from enforcement
waf.bypass.enableboolyesEnable WAF bypass ACL
waf.bypass.acl[]stringyesIP addresses or CIDR ranges that bypass WAF inspection
allowList.enableboolyesEnable IP allow list
allowList.acl[]stringyesIP addresses or CIDR ranges that are exclusively allowed
denyList.actionstringnoStatus code for blocked requests: "400" | "403" | "404". Omitted when the deny list is disabled
denyList.acl[]stringyesIP addresses or CIDR ranges that are blocked
ratelimitobjectnoOmitted when rate limiting is disabled
ratelimit.clientRatefloatyesToken refill rate (tokens/second) for client requests
ratelimit.clientCreditLimitstring (duration)yesMaximum time worth of tokens that can accumulate for client requests
ratelimit.fetchRatefloatyesToken refill rate (tokens/second) for backend fetch requests
ratelimit.fetchCreditLimitstring (duration)yesMaximum time worth of tokens that can accumulate for backend fetch requests

optimisation

This key is optional — it is omitted entirely when WebP image optimisation is disabled.

FieldTypeRequiredNotes
imageopt.qualityintyesJPEG/WebP quality level, 0–100
imageopt.imagetransobjectnoOmitted when image transformation is disabled
imageopt.imagetrans.widthParamstringyesQuery parameter name used to request a specific image width
imageopt.imagetrans.heightParamstringyesQuery parameter name used to request a specific image height
imageopt.imagetrans.allowedDimensions[]stringyesPermitted widthxheight dimension pairs, e.g. "800x600"
imageopt.imagetrans.allowedWidths[]stringyesPermitted width values
imageopt.imagetrans.allowedHeights[]stringyesPermitted height values

overrides

An array of rules that override specific settings for requests matching a given path or file extension. Each rule in the array is an object with the following fields:

FieldTypeRequiredNotes
namestringyesHuman-readable label for the rule
paths[]stringeither/orURL path patterns to match, e.g. "/api/", "^/admin/settings". Mutually exclusive with extensions
extensions[]stringeither/orFile extension patterns to match, e.g. "jpg", "css". Mutually exclusive with paths
rules[]objectyesList of field overrides to apply when this rule matches

Exactly one of paths or extensions must be non-empty — they are mutually exclusive. A rule matches by path or by extension, not both.

Override rule entries

Each entry in the rules array overrides one wizard field for requests that match the override:

FieldTypeNotes
stringIdstringThe dot-notation field identifier, matching the same IDs used in the main configuration (e.g. "general.uncacheable", "cookies.onCookie.action")
valueanyThe value to apply, in the same format as the corresponding field in the main config

The value type must match the field type:

  • Boolean fields: true or false
  • String/select fields: a string, e.g. "remove" or "deny"
  • Array fields: a JSON array of strings, e.g. ["session", "cart"]
  • Table fields (setBackendHeaders, setHeadersForDelivery): an array of {"name": "...", "value": "..."} objects

Matching and precedence

  • Overrides are evaluated in the order they appear in the array.
  • If a request matches multiple overrides, only the first matching override is applied.
  • paths and extensions are mutually exclusive. Only one should be non-empty per rule.
  • Paths support a leading ^ regex character so that a path of /api/ will match /v1/api/endpoint but ^/api/ would not.

Example

{
  "overrides": [
    {
      "name": "Cache static assets for 30 days",
      "paths": [],
      "extensions": ["jpg", "png", "webp", "css", "js"],
      "rules": [
        { "stringId": "general.uncacheable", "value": false },
        { "stringId": "general.cacheableTTLOverride", "value": "30d" }
      ]
    },
    {
      "name": "API passthrough — no caching, no cookies stripped",
      "paths": ["/api/"],
      "extensions": [],
      "rules": [
        { "stringId": "general.uncacheable", "value": true },
        { "stringId": "cookies.onCookie.action", "value": "pass" }
      ]
    },
    {
      "name": "Admin area — allow list only",
      "paths": ["/admin/"],
      "extensions": [],
      "rules": [
        { "stringId": "security.allowList.enable", "value": true },
        { "stringId": "security.allowList.acl", "value": ["10.0.0.0/8", "192.168.1.0/24"] }
      ]
    }
  ]
}