Aug 2, 2024
0
Level 3
Cloudflare cache not working in laravel
I have caching rules in cloudflare that are the same between wordpress and laravel sites, but only on laravel sites the cache is ignored.
Cache header on a website in wordpress:
Alt-Svc: h3=":443"; ma=86400
Cache-Control: max-age=345600
Cf-Cache-Status: HIT
Cf-Ray: 8acb3aeb19bca457-GRU
Content-Encoding: br
Content-Type: text/html; charset=UTF-8
Date: Fri, 02 Aug 2024 04:12:32 GMT
Last-Modified: Fri, 02 Aug 2024 04:00:27 GMT
Link: <https://www.arcdesign.com.br/wp-json/>; rel="https://api.w.org/", <https://www.arcdesign.com.br/wp-json/wp/v2/pages/97>; rel="alternate"; title="JSON"; type="application/json", <https://www.arcdesign.com.br/>; rel=shortlink
Nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=kYpiACw6Iz6AUfq0sWqBEFDyPUPdfJEA8YFtkUwo3lMlpy7UN%2FjID1rZEpUGvT%2BGCC8%2BvwnqR05Gc8GeG%2Fw80B8jnm%2FSwHxhYlxcTELypaNOttYPa9e2FYeOviRn34TdYPuiLU7tL3WTyIULytC3ZcTSLg%3D%3D"}],"group":"cf-nel","max_age":604800}
Server: cloudflare
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Nginx-Upstream-Cache-Status: HIT
X-Server-Powered-By: Engintron
X-Xss-Protection:1; mode=block
Cache header on a website in laravel:
Alt-Svc: h3=":443"; ma=86400
Cache-Control: max-age=0, must-revalidate, no-cache, no-store, private
Cf-Cache-Status: DYNAMIC
Cf-Ray: 8acb2f768c3b8783-GRU
Content-Encoding: br
Content-Type: text/html; charset=UTF-8
Date: Fri, 02 Aug 2024 04:04:43 GMT
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Pragma: no-cache
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=wE7hmt1LVGeeekEcloEsPIFi8pGJCrwYlmh5kpXSd8Tk%2FXTlX99sPJjJEzKS4zlQESP%2By68vne%2FkZcroUYJwqK4NUd2nbc07dHRd15BGowq2g8bmNmdBnOEFMzMmOXSZe%2FvfECHY1vC%2FZn6cA5D0qA%3D%3D"}],"group":"cf-nel","max_age":604800}
Server: cloudflare
Set-Cookie: XSRF-TOKEN=eyJpdiI6IlAyeGxqdkFzdVVEclViNHZNemtnREE9PSIsInZhbHVlIjoiVktFVytLVCtLZW9heVgwUWcyalRmMjlxNmMxcDl6anUvT3JkUGtuMldpNUU0elhweGp3ankza3V1RmRjb20yL2tseUp4WjhZMjlVWkRMQjhDU2tabXFDZWV0Y01ETzBDblVZbTBHVTU0bXRkVGVvZnArbzc3NDlRdjNkbUN3NnIiLCJtYWMiOiIxOWJmN2Q2YTY5ZTFlNmJmOWZhNjA3MzJiNDY4MDAzOTBlYmIxMmIyMTEzNjA5MTk0NDQwNmU5NTQ1Y2FjNGRhIiwidGFnIjoiIn0%3D; expires=Fri, 02 Aug 2024 06:04:42 GMT; Max-Age=7200; path=/; samesite=lax
Set-Cookie: guiato_session=eyJpdiI6IjBHb0l2c0lBUThqeTJWZFg5dTlBQkE9PSIsInZhbHVlIjoibTIrNGRLanY1U2pjMkltaXJXemdmNWZGV1J1S0E4NHZQaWExQytuSWtvU21EN0ppTFRXai9ueUI4OERMNFdITlVibURuTHlBMlNBK1lBaTMrVGlVbHZoeitCT0liNGRwb3hyN2I1dEloeGhERzhpL2ZvY3dHT1lWMG9aU2RmREwiLCJtYWMiOiJlYjdlYmJmZTE2YmJlYTcyNzdhNjZkMDE3NzliYTI5NjkxNTkwOWM1NDEzMjVhZjJlNmI5N2NjODYwOTQwOWVkIiwidGFnIjoiIn0%3D; expires=Fri, 02 Aug 2024 06:04:42 GMT; Max-Age=7200; path=/; httponly; samesite=lax
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Nginx-Upstream-Cache-Status: MISS
X-Server-Powered-By: Engintron
X-Xss-Protection: 1; mode=block
On both sites the cache settings are the same on cloudflare. And the same happens for all websites. Wordpress sites are sent and stored by cache, while sites made in Laravel always have the cache bypassed with BYPASS or DYNAMIC.
Has anyone experienced this and can tell me how to resolve it?
Please or to participate in this conversation.