Login not working - admin/livewire/update 405 (Method Not Allowed)

Laravel 11 with Filament v3. I have a single admin panel, with an empty path, because this app will be running on the /admin folder of the root domain. I've set these Livewire methods to set the correct paths (the issue is also happening without this)
Livewire::setUpdateRoute(function ($handle) {
return Route::post('/admin/livewire/update', $handle);
});

Livewire::setScriptRoute(function ($handle) {
return Route::get('/admin/livewire/livewire.js', $handle);
});
Livewire::setUpdateRoute(function ($handle) {
return Route::post('/admin/livewire/update', $handle);
});

Livewire::setScriptRoute(function ($handle) {
return Route::get('/admin/livewire/livewire.js', $handle);
});
I go to the login screen on admin/login and enter the login credentials it will thrown an error (screenshot attached). On the console it will show (other screenshot):
POST https://example.com/admin/livewire/update 405 (Method Not Allowed)
POST https://example.com/admin/livewire/update 405 (Method Not Allowed)
I have the correct path configured on the laravel app (APP_URL=https://example.com/admin Admin panel configuration (relevant section):
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('')
->login()
->profile(EditProfile::class, false)
->registration(Register::class)
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('')
->login()
->profile(EditProfile::class, false)
->registration(Register::class)
Can someone please point in the right direction? I've tried many things, but nothing worked.
No description
Solution:
Solution was to make a proxy route:
No description
Jump to solution
9 Replies
awcodes
awcodes3mo ago
I hate be questionable, but it this a valid help topic? I don’t personally care what the content of your app is. But definitely not clicking on any of these links.
Diogo Gomes
Diogo GomesOP3mo ago
@awcodes really sorry, but I was a very poor choice of a fake domain :D. I've changed it to example.com
Diogo Gomes
Diogo GomesOP3mo ago
Error on the console
No description
awcodes
awcodes3mo ago
No worries. Lol. Just want to make sure. My best guess is that you are trying to run laravel itself in a sub directory which it’s not setup to do by default so you’ll need to modify your nginx / Apache config to serve it appropriately. Can’t find it right now, but Chris fidao had a good YouTube video on it.
Abdelmjid
Abdelmjid3mo ago
I encountered the same issue, but I resolved it using the following steps: 1. Copy the dist folder located at \vendor\livewire\livewire\dist. 2. Paste it into the public directory. 3. Rename the pasted folder to livewire.
Diogo Gomes
Diogo GomesOP3mo ago
@awcodes thanks for the help. I think the youtube video that you are referring too is this one: https://www.youtube.com/watch?v=tZGg2kdOjhQ&t=12s My server uses .htaccess, but you are probably right about the issue being related with that. I'm going to try to tweak the .htaccess settings @Abdelmjid are you sure that you had the same issue? I've tried your solution but it didn't work. My problem is not related with missing scripts, it's a backend thing, a method not allowed exception, for a route that exists
Patricio
Patricio3mo ago
I haven't worked with Apache for more than 10 years For debuggin, I would start with the access log (Apache) + I would take the public/index.php and do a file_put_contents of $_REQUEST and $_SERVER (plain php global variables) Here, you can see the "step" from the webserver to PHP Analyze after a request, and you can go from there. In terms of how Laravel responds, I guess the route will have to have that prefix, or you can opt in to use rewrites
Solution
Diogo Gomes
Diogo Gomes3mo ago
Solution was to make a proxy route:
No description
Diogo Gomes
Diogo GomesOP3mo ago
Livewire::setUpdateRoute(function ($handle) {
return Route::post('/admin/livewire/update', $handle);
});
Livewire::setUpdateRoute(function ($handle) {
return Route::post('/admin/livewire/update', $handle);
});
This is creating a route with a duplicated admin prefix. https://example.com/admin/admin/livewire/update
Want results from more Discord servers?
Add your server