Livewire is not found on server
I am working on a Laravel project using filament for the admin panel. I try to deploy the same project on my DigitalOcean Droplet. But I am getting a missing Livewire file issue.
Let me first explain my Server structure.
All My Laravel App File reside here:
/var/www/mydomain.com/laravel-core-container/laravel_project_name
And here are all the public files:
/var/www/mydomain.com/html/project-slug/laravel_project_name/demo
and my Live Url is something like this:
https://mydomain.com/laravel_project_name/demo
In the above structure, everything works fine but Livewire could not able to load.
to resolve the livewire issue I have followed these community answers: https://stackoverflow.com/questions/73053717/login-issue-in-laravel-9-x-with-filament
By setting up the asset_url in the config/livewire.php config file the livewire js is loaded.
'asset_url' => '/laravel_project_name/demo/livewire/livewire.js?id=cc800bf4',
But now I am getting the /livewire/update related issue.
error: https://mydomain.com/livewire/update 404 (Not Found)
I have tried to resolve the same by registering the routes in RouteServiceProvide's boot method:
public function boot(): void
{
Livewire::setUpdateRoute(function ($handle) {
return Route::post('/laravel_project_name/demo/livewire/update', $handle);
});
}
Error now:
livewire.js?id=cc800bf4?id=cc800bf4:4275
POST https://mydomain.com/laravel_project_name/demo/livewire/update 419 (unknown status)
Please anyone help me in this, What am I doing wrong?
Please or to participate in this conversation.