Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option to ignore paths with SSR server #574

Open
craigrileyuk opened this issue Jan 4, 2024 · 1 comment
Open

Add config option to ignore paths with SSR server #574

craigrileyuk opened this issue Jan 4, 2024 · 1 comment

Comments

@craigrileyuk
Copy link

Probably a niche case, but in a Laravel project we have two completely separate builds. We have the frontend which uses SSR; then we have the backend admin panel which uses Inertia as well, but does not use SSR.

The problem is that the SSR server will try to respond to every single request (i.e. both the frontend and the backend).

As a quick fix, in inertia-laravel/src/Ssr/HttpGateway.php, in the dispatch function, I've done a check like so:

if (Str::startsWith($page['url'], '/admin')) {
     return null;
}

Would it be possible to add some way to ignore certain routes using the config?

@MitichPavel
Copy link

MitichPavel commented Feb 13, 2024

@craigrileyuk
Maybe this a discussion can help you.
can-inertias-ssr-feature-be-enabled-only-for-some-pages
You can define two different layouts for admin panel and other pages.
views/layouts/app.blade.php <-- this layout is basic and contains for example

@yield('head')

and you can add two additional layouts:
admin.blade.php

// admin.blade.php
@extends('layout.app')

@php($__inertiaSsr = null)

and ssr.blade.php for inertia ssr pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants