vendredi 20 mars 2020

Allow Cloudflare to cache my index page from Laravel

I'm facing a crazy problem, I've a website running on production and I'm trying to cache my index page using "Page Rules" from cloudflare to speed it up, it does not have dynamic content right now.

The problem is that it does not work probably because laravel always return the view with the XSRF-TOKEN and cloudflare will understand it as not-cachable, I already changed the header (cache-control: max-age=36000, public) but cloudflare always return the header "cf-cache-status: BYPASS) when it should return HIT.

When i try to use the same rule on a file from laravel public folder (the same php file of the view) it works ok and returns HIT.

The solution I can think is trying to remove this XSRF-TOKEN from the header response, but I'm going crazy on how to do this, any tips?

Obs: i tried removing those cookies using

            \Config::set('session.driver' , 'array');
            \Config::set('cookie.driver', 'array');

But this remove only one cookies not the XSRF-TOKEN one.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire