inertiajs / inertia-laravel

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

How to define the port? #684

Open kikky7 opened 16 hours ago

kikky7 commented 16 hours ago

The default port used by SSR is 13714.

How to change it?

I use Laravel Forge and I have 2 sites on same server, both using Inertia and SSR. When I enable Inertia SSR via Forge for 2nd site, it starts at same port and kills the SSR of first site.

It's same in local development, when I run both commands to starts SSR php artisan inertia:start-ssr, the other one gets killed.

I can't find any docs in Inertia or Laravel docs how to update the port.

RobertBoes commented 16 hours ago

You'd have to update the config on where to find the server; https://github.com/inertiajs/inertia-laravel/blob/c4026af538c21355a11c4f90f2a9e0bad7abd88d/config/inertia.php#L26

To run it on a different port you pass it to createServer as the second parameter; https://github.com/inertiajs/inertia/blob/9106d74495130a3d82d00daec43c4042b81bdb63/packages/core/src/server.ts#L16 in your ssr.js file