Tahmid
Tahmid

Reputation: 83

Why am I getting 404 error on my livewire.js connection?

I am using Laravel 8. "wire:model" also not working because of this.

Upvotes: 1

Views: 4846

Answers (4)

Mohamed Mo Kawsara
Mohamed Mo Kawsara

Reputation: 4688

Just the following code to your admin or control panel routes:

use Livewire\Controllers\HttpConnectionHandler;

Route::post('livewire/message/{name}', [HttpConnectionHandler::class, '__invoke']);

And remember to override the url using this one linear:

<script>
    window.livewire_app_url = '{{route('admin.index')}}';
</script>

More detailed answer could be found here

Laravel - Livewire, how to customize the global message URL?

Upvotes: 0

AKASH KUMAR
AKASH KUMAR

Reputation: 1

You need to setup the livewire app url in config/livewire.php.

'app_url' =>  url('/'),

Upvotes: 0

xavierz
xavierz

Reputation: 43

in config/livewire.php

'asset_url' => url('/'),

Upvotes: 0

Kamlesh Paul
Kamlesh Paul

Reputation: 12391

you need to setup livewire base url

in config/livewire.php

'asset_url'  =>  env('APP_URL', 'http://localhost'),,

then in .env

APP_URL=your_app_url

Upvotes: 4

Related Questions