Condition

Conditions are used to control whether logic defined in configured VCL objects is applied for a particular client request. A condition contains a VCL conditional expression that evaluates to either true or false and is used to determine whether the condition is met. The type of the condition determines where it is executed and the VCL variables that can be evaluated as part of the conditional logic.

Data model

commentStringFree text field to record a note or description of the condition, which will be displayed in the management web interface.
nameStringName of the condition. Required.
priorityIntegerPriority assigned to condition. Lower numbers execute first. Defaults to 0.
service_idStringThe ID of the service to which to attach the condition.
statementStringA conditional expression in VCL used to determine if the condition is met.
typeStringType of the condition. Required.
requestMake the condition available everywhere. This type of condition may only reference VCL variables that are accessible throughout the VCL flow.
cacheMake the condition available in the vcl_fetch subroutine at the fetch phase of the VCL flow. This type of condition may access VCL variables in the beresp namespace.
responseMake the condition available in the vcl_deliver subroutine at the delivery phase of the VCL flow. This type of condition may access VCL variables in the resp namespace.
prefetchMake the condition available in the vcl_miss and vcl_pass subroutines at the prefetch phase of the VCL flow. This type of condition may access VCL variables in the bereq namespace.
versionIntegerThe version of the service to which to apply the condition. The specified version must be unlocked to allow editing.

Endpoints

List conditions

GET/service/service_id/version/version/condition

Describe a condition

GET/service/service_id/version/version/condition/name

Create a condition

POST/service/service_id/version/version/condition

Update a condition

PUT/service/service_id/version/version/condition/old_name

Delete a condition

DELETE/service/service_id/version/version/condition/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.