Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mesasix's avatar
Level 19

Nginx Fastcgi cache

Hello,

Anyone used fastcgi cache for laravel?

I cant seem to get around the configuration to cache only non authenticated requests since laravel adds the same cookie name for both auth/non auth users.

Any help is greatly appreciated.

Edit: I can add a custom cookie with arbitrary value that determines authenticated user using a response/after middle-ware and read it from nginx but it seems like a far fetched solution. Im wondering if there is a more elegant solution.

0 likes
1 reply
OstapBrehin's avatar

I think this behaviour is due to the session being enabled on guest pages.

You can create a new route group that doesn't include session in the RouteServiceProvider

Please or to participate in this conversation.