Deployment
Deploying your application to production.
Since Inertia Start is a standard Laravel application, you can deploy it to any hosting provider that supports PHP and Laravel. Review the Laravel Deployment documentation for best practices.
General Guidelines
When deploying to production, remember to:
- Optimize autoloader:
composer install --optimize-autoloader --no-dev - Cache configuration:
php artisan config:cache - Cache events:
php artisan event:cache - Cache routes:
php artisan route:cache - Cache views:
php artisan view:cache - Build assets:
npm run build
Recommended Services
Laravel Cloud
Laravel Cloud is the easiest, fastest and all-in-one platform to deploy and scale Laravel applications.
Laravel Forge
If you want to use your own server but don't want to deal with the pain of server management, you can use Laravel Forge.
Ploi.io
Similar to Forge, Ploi.io offers a robust alternative for server management.
Cloudflare proxy
Inertia Start resolves the visitor IP address and country from the incoming request (Helpers::getClientIp() and Helpers::getRequestContext()). These values are used for rate limiting, activity logs, and login notifications, and they are only reliable when the proxies in front of your application are trusted.
On Laravel Cloud
There is nothing to configure: Laravel Cloud manages its own proxy chain and resolves trusted proxies for you, and the framework resolves the client IP address and protocol from the standard X-Forwarded-* headers.
Leave I_S_BEHIND_CLOUDFLARE_PROXY unset (or false) there (it will be ignored anyway).
On other hosting providers
When you serve your application behind your own Cloudflare DNS proxy, enable Cloudflare support:
I_S_BEHIND_CLOUDFLARE_PROXY=trueApp\Http\Middleware\TrustProxies then adds the current Cloudflare IP ranges to Laravel's trusted proxies, and the CF-Connecting-IP and CF-IPCountry headers are honored only for requests coming from a trusted proxy. Requests hitting your origin directly (bypassing Cloudflare) fall back to the connecting IP address and carry no country.
The IP ranges are fetched from the Cloudflare API and cached, then refreshed every six hours by the cloudflare:proxies command scheduled in routes/console.php. Make sure the Laravel scheduler is running on your server. You can also refresh them manually at any time:
php artisan cloudflare:proxiesCountry detection
The country is only available when IP geolocation is enabled in your Cloudflare dashboard, under [ Website ] > Network. Cloudflare then sends it in the CF-IPCountry header.