The POST method is not supported for route admin/login. Supported methods: GET, HEAD.

login request method is POST. how i can change it ? when i see list of routes admin/login method is GET/HEAD. local its working but production i have this error
No description
81 Replies
LeandroFerreira
LeandroFerreira9mo ago
Were you using v2, and did you upgrade to v3? Also, did you publish the Livewire config?
gigiloouu
gigiloouuOP9mo ago
yep i was using v2 and next i update v3 what do u mean "publish the livewire config"
LeandroFerreira
LeandroFerreira9mo ago
Laravel
Installation | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
gigiloouu
gigiloouuOP9mo ago
u sure this will fix it ? becouse problem is that login method is post i do php artisan livewire:publish --config but same error any ideas?
gigiloouu
gigiloouuOP9mo ago
lol i try to find same error in post list but i didnt find okay let me see hm i do same thing what this posst author saiid but
php artisan vendor:publish --force --tag=livewire:assets --ansi

INFO No publishable resources for tag [livewire:assets].
php artisan vendor:publish --force --tag=livewire:assets --ansi

INFO No publishable resources for tag [livewire:assets].
any ideas ? 💀 @Leandro Ferreira
LeandroFerreira
LeandroFerreira9mo ago
some config that you need to check in your prod server, but I don't have idea
gigiloouu
gigiloouuOP9mo ago
hm and do u have any idea where or how i can start debuging it ? like what i should do 💀 i really have no idea why 💀
LeandroFerreira
LeandroFerreira9mo ago
Where are you deploying it?
gigiloouu
gigiloouuOP9mo ago
On my server project is running everything is okay database too just when i enter login i have this error becouse its send login request and this request method is post and becouse of that is ihis erorr
pythonista
pythonista9mo ago
Any solution to this. Currently facing this error
gigiloouu
gigiloouuOP9mo ago
nah i have same erorr and i have no idea how i can fix it 😄
LeandroFerreira
LeandroFerreira9mo ago
I guess this issue isn’t related to Filament; rather, it’s connected to your server configuration for using Livewire. It might be helpful if you could provide additional information about the type of service you’re using and where you’re deploying it. Maybe someone who has encountered a similar issue can help you.
pythonista
pythonista9mo ago
I am using hostinger vps with Ubuntu 22.04 I hosted on cpanel and it works fine , so maybe my server configuration is not correct
gigiloouu
gigiloouuOP9mo ago
livewire was a problem..
pythonista
pythonista9mo ago
Did you solve the error
vp35161
vp351615mo ago
How did you soleve it ? i tried publishing the livewire assets but still not help the post issue
awcodes
awcodes5mo ago
It's possible your server is trying to serve the livewire js as a static assets instead of letting it be served by php. Try this in your nginx config
location ^~ /livewire {
try_files $uri $uri/ /index.php?$query_string;
}
location ^~ /livewire {
try_files $uri $uri/ /index.php?$query_string;
}
vp35161
vp351615mo ago
i dont think i have nginx and also i dont understand how it can work without any pb in local and not on dev furthermore i am thinking to make a login controller on my own but it defeats the purpose i think in vendor fillamnet there is login class under pages/auth cant it be used instead of building a contrller in my app ? i have appache and htaccess -- il try see how to do what you said though guess like so RewriteRule ^livewire/(.*)$ /index.php/livewire/$1 [L] same -- it seems there is no route for login no matter what how can I do it in web so I have a login route pointing to filament login ? any link for this or do i have to do my own implementation of login ?
Tetracyclic
Tetracyclic5mo ago
The login is handled by Livewire's update route, as anything Livewire goes via that.
vp35161
vp351615mo ago
I understand this but I am a newbie in Fil and Liv so any direct help / resource would help me
Dennis Koch
Dennis Koch5mo ago
Do you have any browser in the console or network tab? Because it should use POST to login
vp35161
vp351615mo ago
Status 405 Method Not Allowed VersionHTTP/1.1 Transferred261.37 kB (261.02 kB size) Referrer Policystrict-origin-when-cross-origin Request PriorityHighest DNS ResolutionSystem
allow GET, HEAD Cache-Control no-cache, private Connection Keep-Alive Content-Type text/html;charset=UTF-8 Date Tue, 25 Jun 2024 19:22:12 GMT Host 127.0.0.1:8000 Keep-Alive timeout=5, max=100 Server Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k Transfer-Encoding chunked from what i am figuring it simply doenst find any route to the login whle i am on the remote server
vp35161
vp351615mo ago
i also have a problem on tailwind but i dont think it is affecting the post
build vite build
vite v5.3.1 building for production... transforming (1) resources/js/app.js warn - The content option in your Tailwind CSS configuration is missing or empty. warn - Configure your content sources or your generated CSS will be missing styles. warn - https://tailwindcss.com/docs/content-configuration
Content Configuration - Tailwind CSS
Configuring the content sources for your project.
vp35161
vp351615mo ago
i must mention too that my tables allready exists as i coppied them form the local project - idk if this si a problem that can affect that post - it doens t seem to me for now until i figured it out i would even be ok to disable the login so that i see it work and maybe port what i did to simple tabel builders ... but it was very wasy to set it up on local via panel and now im stuck here 😭 setting it to null goes to this Route [login] not defined. so again back to not difnding route
Dennis Koch
Dennis Koch5mo ago
Setting what to null? You should define a redirect named login that redirects to the Filament login.
vp35161
vp351615mo ago
login in panel
Dennis Koch
Dennis Koch5mo ago
When does the error occur? Immediately on visiting the site? Or when submitting the login form?
vp35161
vp351615mo ago
when subimiting i can go to admin see the form i input user psw as i do iin local i also did this sh file
Dennis Koch
Dennis Koch5mo ago
So is there any browser(!) error before submitting?
vp35161
vp351615mo ago
no vrowser error - just missing styles becasue of tailwind in network i see errors in get related to that
Dennis Koch
Dennis Koch5mo ago
Can you share a screenshot of that network tab?
vp35161
vp351615mo ago
this is a file i did so i wnto have to redo a lot of steps over and over again yes i am one mom
Dennis Koch
Dennis Koch5mo ago
You are really running the built in PHP server on production?! That one is meant for local/dev only.
vp35161
vp351615mo ago
it is a test what is meant only for local dev ? i dont get it this is a panel for internal usage it is not public
Dennis Koch
Dennis Koch5mo ago
The PHP Server is not meant for production. Not filament.
vp35161
vp351615mo ago
it is not exposed to public is internal usage production is just a name here it runs anyway under many layers of security and passwords and redirects
Tetracyclic
Tetracyclic5mo ago
This is the same error you get if the JS isn't loading properly. Instead of the submit button posting to the Livewire update route, it sends a post request toadmin/login, which doesn't support it.
Dennis Koch
Dennis Koch5mo ago
That’s why I am asking for the screenshot of the network tab 😅
vp35161
vp351615mo ago
i will sned one mom
vp35161
vp351615mo ago
No description
No description
No description
No description
vp35161
vp351615mo ago
idk why i have the warn on tailwind .. i dont remeber exactly what solved it
Dennis Koch
Dennis Koch5mo ago
Um. You are literally missing all scripts. This is not „just tailwind“
vp35161
vp351615mo ago
hmm check my sh pls
Dennis Koch
Dennis Koch5mo ago
It tried to connect to localhost. That won’t work if this is on a different server. You didn’t change your .env. Did you?
vp35161
vp351615mo ago
changed it when ? the sh deletes all and then pulls it and push the .env from anothe env i have
Dennis Koch
Dennis Koch5mo ago
Where is this stuff running? On your local machine or on a remote server?
vp35161
vp351615mo ago
now on remote i am trying to serve it the first 2 lines shows the ip this is why you have 2 success with 2 pcitures
Dennis Koch
Dennis Koch5mo ago
So you need to adjust your .env to that servers config.
vp35161
vp351615mo ago
i did it but i ll check it again
Dennis Koch
Dennis Koch5mo ago
Share your env file please.
vp35161
vp351615mo ago
cant share it with sensitiive data -- just tell me wich fields should i cahnge? the mysql cant provide here ? APP_URL=http://localhost i should input something else i think ?
Dennis Koch
Dennis Koch5mo ago
Localhost is probably not the server you are running this on if it’s remote. You need to use the actual URL of that server.
vp35161
vp351615mo ago
ok so this is the field i was dofucisng only n mysql so APP_URL=http://localhost here i need change it ok ty let me try it ty for patience
Dennis Koch
Dennis Koch5mo ago
If you also have a ASSETS_URL you need to change that too
vp35161
vp351615mo ago
dont have asset url in env .. i put the main url .. should it contain the path to the alias in conf / htaccess ? i mean like url_base/alias_that_is_mapped_to_local_path_of_the_files ? or just the main ? cuase in thtaccess ai have the redirection to index so it shoudl know where what
Dennis Koch
Dennis Koch5mo ago
It should be the same URL you input into the browser to access the root of your Laravel site
vp35161
vp351615mo ago
ok got it brb cause i ony put the short one wihtotu alias .. in this case thereis only 1 error now .. all rest are gone brb same localhost:8000
Dennis Koch
Dennis Koch5mo ago
What?
vp35161
vp351615mo ago
nothing changed in the GET here is the same i tired in 3-4 ways the url
Dennis Koch
Dennis Koch5mo ago
Did you use localhost again as APP_URL?!
vp35161
vp351615mo ago
no
Dennis Koch
Dennis Koch5mo ago
Whats the comment about localhost:8000 then?! 🤔
vp35161
vp351615mo ago
i used my server or i user myserver/alias from the conf 127 0 0 1
Dennis Koch
Dennis Koch5mo ago
What’s your browser url and what’s the app url?! Those need to be the same. Can you please not post random ips/domains without explaining anything? That’s just confusing
vp35161
vp351615mo ago
APP_URL=my_url/my_alias_from_apache (i can get to welcome page of laravel with no error) when i use /admin i get the picture i showed you above with all the errors and the GET on 127.0.0.1:8000 if i serve it form my remote shoudlnt it be localhost/my_alias ? i will do some more tests with the urls and db's and will come back tommoow if i dont solve it ty for your patience
Dennis Koch
Dennis Koch5mo ago
No. Remote is not a localhost. As the name implies that’s always the current server.
vp35161
vp351615mo ago
ok. unnderstood @Dennis Koch Hi. I understood what you were reffering on production and so on (i stopped using the serve on artisan cause i allready have the apache :)) . I have some problems with sellinux but atm for just testings I am close to having it okay on production. The only problem I face is that the login route doesnt work under the protected middleware and I dont know if i Have to do any separate routes for login or not (i tried but it doesnt work). Without middleware I can see the login page of fillament, but with it, something is out of my grasping. If you or any other user can guide a bit, it would ne awesome ( i am srtugling for many hours on this part 😦 )
<?php

use Illuminate\Support\Facades\Log;

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;

use App\Models\NodDb;

//use Filament\Facades\Filament;
use App\Providers\Filament\AdminPanelProvider;

use App\Http\Controllers\Auth\LoginController;


//** Test route
Route::get('/', function () {
return view('welcome');
});

//Route::get('/login', [LoginController::class, 'showLoginForm'])->name('login');
//Route::post('/login', [LoginController::class, 'login']);
//Route::post('/logout', [LoginController::class, 'logout'])->name('logout');

////** Protected routes (by fillament !?)
Route::middleware(['web', 'auth'])->group(function () {
Route::get('/admin', [AdminPanelProvider::class, 'panel'])->name('admin.panel');
//Route::get('/admin', [AdminPanelProvider::class, 'index'])->name('admin.index');
// Add other protected routes here!
});
<?php

use Illuminate\Support\Facades\Log;

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;

use App\Models\NodDb;

//use Filament\Facades\Filament;
use App\Providers\Filament\AdminPanelProvider;

use App\Http\Controllers\Auth\LoginController;


//** Test route
Route::get('/', function () {
return view('welcome');
});

//Route::get('/login', [LoginController::class, 'showLoginForm'])->name('login');
//Route::post('/login', [LoginController::class, 'login']);
//Route::post('/logout', [LoginController::class, 'logout'])->name('logout');

////** Protected routes (by fillament !?)
Route::middleware(['web', 'auth'])->group(function () {
Route::get('/admin', [AdminPanelProvider::class, 'panel'])->name('admin.panel');
//Route::get('/admin', [AdminPanelProvider::class, 'index'])->name('admin.index');
// Add other protected routes here!
});
problem is Route [login] not defined. i might be doing something bad on my index, i tried multiple solutions:
<?php

use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}

// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';

//** vali */
// Set the base URL for the application

//**************************************** Debug information --- NU MERGE -- NU VAD NIMIC IN LOGURI !!! DE CE ???
file_put_contents(__DIR__ . '/../storage/logs/debug.log', print_r("we have data: .. " . $_SERVER . "\n", true), FILE_APPEND);

// Bootstrap Laravel and handle the request...
$app = require_once __DIR__.'/../bootstrap/app.php';

//// Set the base URL dynamically
//if (isset($_SERVER['HTTP_HOST'])) {
// $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
// $baseUrl .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
// $baseUrl = rtrim($baseUrl, '/');
// $baseUrl = str_replace('public', '', $baseUrl);
// $_SERVER['HTTP_HOST'] = $baseUrl;
//}


//$app->register(AdminPanelProvider::class);

$app->make(Illuminate\Contracts\Http\Kernel::class)
->handle(Request::capture()
)->send();


//** original ... */
// Bootstrap Laravel and handle the request...
//(require_once __DIR__.'/../bootstrap/app.php')
// ->handleRequest(Request::capture());
<?php

use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}

// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';

//** vali */
// Set the base URL for the application

//**************************************** Debug information --- NU MERGE -- NU VAD NIMIC IN LOGURI !!! DE CE ???
file_put_contents(__DIR__ . '/../storage/logs/debug.log', print_r("we have data: .. " . $_SERVER . "\n", true), FILE_APPEND);

// Bootstrap Laravel and handle the request...
$app = require_once __DIR__.'/../bootstrap/app.php';

//// Set the base URL dynamically
//if (isset($_SERVER['HTTP_HOST'])) {
// $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
// $baseUrl .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
// $baseUrl = rtrim($baseUrl, '/');
// $baseUrl = str_replace('public', '', $baseUrl);
// $_SERVER['HTTP_HOST'] = $baseUrl;
//}


//$app->register(AdminPanelProvider::class);

$app->make(Illuminate\Contracts\Http\Kernel::class)
->handle(Request::capture()
)->send();


//** original ... */
// Bootstrap Laravel and handle the request...
//(require_once __DIR__.'/../bootstrap/app.php')
// ->handleRequest(Request::capture());
Dennis Koch
Dennis Koch5mo ago
Your message would be more readable if you were using code formatting (see #✅┊rules )
problem is Route [login] not defined.
Laravel expects that route. Just do a redirect named login that redirects to Filament login page
vp35161
vp351615mo ago
sry, i did revised the code 🙂 i tried with wrong ''' before 🙂 fillament login page is /admin/login , right ?
Vp
Vp5mo ago
Do like this for Route [login] problem
Route::get('/login', function () {
return redirect('admin'); // $panel->path('admin') in filament service provider
})->name('login');
Route::get('/login', function () {
return redirect('admin'); // $panel->path('admin') in filament service provider
})->name('login');
vp35161
vp351615mo ago
ok but if i want under midldleware ? Route::middleware(['web', 'auth'])->group(function () { Route::get('/admin', [AdminPanelProvider::class, 'panel'])->name('admin.panel');
Vp
Vp5mo ago
No, login page should be outside of 'auth' middleware, because we need to see without authenticate
vp35161
vp351615mo ago
ah ok got it
Dennis Koch
Dennis Koch5mo ago
You don't need to register any Filament pages. Filament does that for you
vp35161
vp351615mo ago
what is the auth login path for filalment ? where do i find it ?
Dennis Koch
Dennis Koch5mo ago
{the_path_to_your_panel}/login
vp35161
vp351615mo ago
ok let me ssee if i can make it with your info found this in routes.php so it si clearly doing it on itself Route::name('auth.')->group(function () use ($panel) { if ($panel->hasLogin()) { Route::get($panel->getLoginRouteSlug(), $panel->getLoginRouteAction()) ->name('login'); }
Dennis Koch
Dennis Koch5mo ago
You have login enabled on your panel right? ->login()
vp35161
vp351615mo ago
yes
Want results from more Discord servers?
Add your server