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

mes's avatar
Level 5

Can Inertia's SSR feature be enabled only for some pages?

I'm trying to decide if I'm going to use Inertia or Livewire for a side project of mine. I'm going to need Server Side Rendering only for a few paths in my app but not all of them and was wondering if Inertia allows for excluding or including only certain Pages to be SSR'ed. I've searched through the docs and the Github issues/discussions and didn't find anything related to this. Has anyone here tried this? Thanks!!

0 likes
10 replies
alqahtani's avatar

On the paths you need to be SSRed you can return normal view return view(...) from the controller and laravel will handle rendering these paths on the server and not Inertia

1 like
MohamedTammam's avatar

@alqahtani How that will work with Inertia, for example if you want the user to load profile page as SPA and also that profile page is public for search engines?

mes's avatar
Level 5

@alqahtani But that means I can't use any of my React/Vue components right? I still want some paths to be Inertia, just to not go through the node SSR process.

wingly's avatar

What do you gain by doing this? Why simply not have the whole thing SSRed ?

mes's avatar
Level 5

@wingly I'm just curious about the possibility of doing this, not that I really need it to be honest. Having used Next.js in the past where you can choose on a by-page basis what to SSR and what to not I was just wondering if this was possible.

mes's avatar
Level 5

@unkn0wn see the "best answer" below, it seems this is possible with the small trick mentioned there.

x4afe3's avatar
x4afe3
Best Answer
Level 1

By setting $__inertiaSsr = null in your blade view you can disable SSR. You can set this depending on the route in your app.blade.php to exclude it from the SSR:

@if(Request::is('app/*'))
   @php($__inertiaSsr = null)
@endif
3 likes

Please or to participate in this conversation.