STALE response takes time to load when 522 origin occurs

Hello to the community,

I have a question regarding how cloudflare handles stale-if-error cache control header.

I am testing the following rules by simulating origin downtime from a test server:

cache-control: public, max-age=60, stale-while-revalidate=30, stale-if-error=1800

The results that I observe are the following.

1 scenario) Origin server is down (nginx service stopped) - cf error 521

STALE response is activated - takes 20-30 milliseconds to complete

HTTP/1.1 200 OK
Date: Wed, 30 Jun 2021 14:35:43 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
Cache-Control: public, max-age=0
CF-Cache-Status: STALE

2 scenario) Network timeout (In order to simulate it, I changed the DNS A record to a non-existing IP) - cf error 522.

STALE response is activated - - takes around 20-30 seconds to complete!

age: 167
cache-control: max-age=60
cache-control: public, stale-if-error=1800
cf-cache-status: STALE
cf-ray: 66baaaacddad38d6-ATH
content-encoding: gzip```

Is it normal have this difference in response time for this different scenarios? 

I suspect this may be a reason but I am not sure.


*Before a connection is established, the origin web server does not return a SYN+ACK to Cloudflare within 15 seconds of Cloudflare sending a SYN.*
*After a connection is established, the origin web server doesn’t acknowledge (ACK) Cloudflare’s resource request within 90 seconds.*

Any guidance is appreciated,

Thank you

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.