One solution to this problem is to update the AppServiceProvider to check if the request is secure and set the URL scheme accordingly. Here's an example:
use Illuminate\Support\Facades\URL;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
if ($this->app->environment('production')) {
URL::forceScheme('https');
}
}
}
This will force the URL scheme to be https in production environments. Additionally, you can use the secure_url() helper function to generate secure URLs throughout your application.