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

SSR specific page #7

Open
ayophanz opened this issue Feb 12, 2022 · 2 comments
Open

SSR specific page #7

ayophanz opened this issue Feb 12, 2022 · 2 comments

Comments

@ayophanz
Copy link

I have admin and public pages now I want to exclude all pages under admin folder and only SSR the pages under public folder.

@timacdonald
Copy link

timacdonald commented Aug 9, 2022

You may create an application middleware that turns it back on or off for only the routes you would like.

For example, in Laravel we may do the following...

namespace App\Http\Middleware;

use Illuminate\Support\Facades\Config;

class EnableSsr
{
    protected $except = [
        'admin/*',
        'portal/*',
    ];

    public function handle($request, $next)
    {
        Config::set('inertia.ssr.enabled', ! $request->is($this->except));

        return $next($request);
    }
}

@ayophanz
Copy link
Author

ayophanz commented Aug 9, 2022

Thanks

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