time.is_after
Available inall subroutines.
Returns true
if t1
is after t2
. (Normal timeflow and causality required.)
Example
if (time.is_after(now, time.hex_to_time(1000000, beresp.http.X-Absolute-Cacheable-Microtime))) { set obj.cacheable = 0;} else { set obj.cacheable = 1;}
Try it out
time.is_after
is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.
Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.
Create self-destructing URLs for time-limited access
Make URLs expire after a configurable period.
Ban bad IPs for a fixed period
Block a list of IP addresses from accessing your service and include an expiry time.
Authenticate JSON Web Tokens at the edge
Decode the popular JWT format to verify user session tokens before forwarding trusted authentication data to your origin.