POST 404 with Livewire + mcamara/laravel-localization

Not sure if I should focus more on Livewire or localization package.
The callback from livewire works perfectly when current locale is same as Laravel default locale in config/app.php. Here goes example:

My url is myapp.test/section/somepage, the component executes as expected, the response from myapp.test/livewire/message/path.to.my-component is 200, and DOM updates. So far so good.

Then I switch current locale to “da”.

Same scenario, different results:
The url is myapp.test/da/section/somepage now - the component loads, but when I ty to call some method, the response from myapp.test/livewire/message/path.to.my-component is 404.

What is interesting, when I put some breakpoint in render(), right before “return view…”, the response is 200, and the modal displays the breakpoint content (for example dd(1); echoes 1).

I tried to setup laravel-localization config with
‘urlsIgnored’ => [’/livewire/*’],
also tried to apply translation middlewares to route group and use it in config/livewire.php - no luck.

My environment is Laravel 8, Livewire 2.0
I’d really appreciate your suggestions.

Solved it.
The solution is to add app route localized through mcamara/laravel-localization middleware:

    window.livewire_app_url = "{{route('app_route')}}"; // generates https://myapp.test/ or https://myapp.test/da/ depending on current locale

And I had to create route to livewire/message inside localized routes group in my web.php:

Route::group([
    'prefix' => LaravelLocalization::setLocale(),
    'middleware' => ['localeSessionRedirect', 'localizationRedirect']
], function () {
    // some routes with livewire components...
    Route::post('livewire/message/{name}', '\Livewire\Controllers\HttpConnectionHandler');   
});

Then Livewire callbacks work as a charm.
It also solves multitenant setup - you can put the livewire route within some groups with middlewares attached to segments and it still works!
Example:

Blade:

    window.livewire_app_url = "https://myapp.test/client/p,29/s,9/"

web.php:

Route::group(['prefix' => 'client'], function () {

    Route::group(['prefix' => 'p,{profile}', 'middleware' => ['profileAccess']], function () {
        Route::group(['prefix' => 's,{shop}', 'middleware' => ['shopAccess'], 'as' => 'shop.'], function () {

        // some routes with livewire components... 

        Route::post('livewire/message/{name}', '\Livewire\Controllers\HttpConnectionHandler');

        });
    });
});