inertiajs / inertia-laravel

The Laravel adapter for Inertia.js.
https://inertiajs.com
MIT License
1.99k stars 222 forks source link

multiple node instance #597

Closed yahya077 closed 3 months ago

yahya077 commented 4 months ago

In a Laravel project, I have multiple SSR (Server-Side Rendering) apps. Even when I launched their nodes separately, they were consistently redirecting to the first node. Therefore, I restructured the setup to work with multiple nodes seamlessly.

Example Config (inertia.php)

{
  'ssr' => [
        "default" => [
            'enabled' => true,

            'url' => 'http://127.0.0.1:13714',

            'bundle' => base_path('bootstrap/ssr/ssr.mjs'),
        ],
        "business" => [
            'enabled' => true,

            'url' => 'http://127.0.0.1:13713',

            'bundle' => base_path('bootstrap/ssr/ssr2.mjs'),
        ],
        "app" => [
            'enabled' => true,

            'url' => 'http://127.0.0.1:13712',

            'bundle' => base_path('bootstrap/ssr/ssr3.mjs'),
        ],
    ],
  }

Vite Config (vite.config.js)

ssr: [
       'resources/js/customer/ssr.js',
       'resources/js/business/ssr.js',
       'resources/js/app/ssr.js'
],

Middlewares

I added separate middlewares for each app consistently.;

// both of them has their conf.
class HandleInertiaAppRequests extends Middleware
protected $bundleConfig = 'app';

class HandleInertiaBusinessRequests extends Middleware
protected $bundleConfig = 'business';
driesvints commented 3 months ago

Seems this breaks the test suite.