To force Inertia requests to use HTTPS, you can modify the app/Providers/AppServiceProvider.php file in your Laravel application.
First, import the URL facade at the top of the file:
use Illuminate\Support\Facades\URL;
Then, within the boot method, add the following code:
public function boot()
{
if (config('app.env') === 'production') {
URL::forceScheme('https');
}
}
This code checks if the application environment is set to "production" (you can change this condition to match your environment). If it is, it forces the URL scheme to be HTTPS.
Remember to import the URL facade at the top of the file and run composer dump-autoload to autoload the changes.
This will ensure that Inertia requests use HTTPS instead of HTTP in a production environment.