Hi,
I am getting an inconsistent result for TTL on a webpage.
The file is at path /static/css/styles.css
The server is sending a header “cache-control:max-age=604800”
At that point, you would expect to see a TTL based on 604800 which is a week. It would count down from a week.
In a VCL snippet, fetch, priority 100:
if ( req.url ~ "^/$" ) {
set beresp.ttl = 300s;
return (deliver);
} else if ( req.url ~ "^/static/css/" ) {
set beresp.ttl = 300s;
return (deliver);
...
The TTL is being overridden to 300s.
Which will take precedence? 604800s or 300s? The intention is to use 300s.
On the command-line, running this command:
curl -svo /dev/null -H "Fastly-Debug:1" https://www.example.com/static/css/styles.css 2>& 1 | grep fastly-debug-ttl 2>&1
result:
< fastly-debug-ttl: (H cache-den8262-DEN 602565.735 0.000 2234)
fastly-debug-ttl shows the TTL is based on the 604800. It’s not using 300 seconds.
Then completely purge the cache from the Fastly console.
Run the command again a few times.
curl -svo /dev/null -H "Fastly-Debug:1" https://www.example.com/static/css/styles.css 2>& 1 | grep fastly-debug-ttl 2>&1
result:
< fastly-debug-ttl: (H cache-den8265-DEN 289.977 0.000 10)
Now it’s 300 seconds. Great! That was the goal. Although it’s mysterious since the VCL didn’t change.
I had done a full purge from the Fastly console, before that. Maybe the purge fixed it.
Wait another 5 minutes.
curl -svo /dev/null -H "Fastly-Debug:1" https://www.example.com/static/css/styles.css 2>& 1 | grep fastly-debug-ttl 2>&1
result:
< fastly-debug-ttl: (H cache-den8263-DEN 604793.347 0.000 7)
Back to using 604800 seconds as the TTL.
Any ideas about what’s happening?