Enabling Inertia SSR in Laravel
henryo
PROOP

23 days ago

In reference to this previous question asked regarding this https://station.railway.com/questions/how-to-enable-inertia-ssr-in-a-laravel-p-0387a280

I have set up two services one is Laravel APP and the other is Inertia SSR

On the inertia ssr i have INERTIA_SSR_ENABLED is true and i have npm install && npm run build:ssr as custom build and a start command of php artisan inertia:start-ssr

On the Laravel app i have INERTIA_SSR_ENABLED=true and INERTIA_SSR_URL= and i also have npm install && npm run build

But the problem is that i don't think this setup works as the website is not loaded with ssr

not sure what i am doing wrong

Solved$20 Bounty

4 Replies

Railway
BOT

23 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


henryo
PROOP

21 days ago

I finally got Inertia SSR working on Railway using two separate services:

  • Laravel Web App

  • Inertia SSR Server

Here’s the exact setup in a simple format:

1. Laravel Web Service

Environment variables:

INERTIA_SSR_ENABLED=true
INERTIA_SSR_URL=http://<your-ssr-service>.railway.internal:13714

Use the Private Networking URL from the SSR service (not the public URL).

Example:

http://private.railway.internal:13714

Build (optional):

npm install && npm run build

Laravel will now call the SSR server internally.

2. Inertia SSR Service

Railway detects this as PHP, so Node is not available at runtime.

To solve that:

Build command:

npm install && npm run build:ssr

Start command:

chmod +x run-node.sh && ./run-node.sh

run-node.sh:

#!/bin/bash
set -e

# Install Node at runtime
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get update && apt-get install -y nodejs

# Start Inertia SSR server
php artisan inertia:start-ssr --runtime=node

This ensures Node exists when the SSR server starts.

SSR now works on every page load


Status changed to Solved brody 21 days ago


henryo
PROOP

19 days ago

Hello Where is my $20 bounty?


Status changed to Awaiting Railway Response Railway 19 days ago


henryo

Hello Where is my $20 bounty?

uxuz
MODERATOR

19 days ago

Hey, there is no bounty as you have solved the issue yourself. The bounty awarded label will serve as an indicator to mark this thread as solved.


Status changed to Solved uxuz 19 days ago


Loading...