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
81 Replies
Were you using v2, and did you upgrade to v3? Also, did you publish the Livewire config?
yep i was using v2 and next i update v3
what do u mean "publish the livewire config"
Laravel
Installation | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
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?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
any ideas ? 💀
@Leandro Ferreira
some config that you need to check in your prod server, but I don't have idea
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 💀
Where are you deploying it?
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
Any solution to this. Currently facing this error
nah i have same erorr and i have no idea how i can fix it 😄
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.
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
livewire was a problem..
Did you solve the error
How did you soleve it ? i tried publishing the livewire assets but still not help the post issue
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
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 ?
The login is handled by Livewire's
update
route, as anything Livewire goes via that.I understand this but I am a newbie in Fil and Liv so any direct help / resource would help me
Do you have any browser in the console or network tab?
Because it should use POST to login
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
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
i also have a problem on tailwind but i dont think it is affecting the post
build vite buildvite 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-configurationContent Configuration - Tailwind CSS
Configuring the content sources for your project.
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
Setting what to null?
You should define a redirect named login that redirects to the Filament login.
login in panel
When does the error occur? Immediately on visiting the site? Or when submitting the login form?
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
So is there any browser(!) error before submitting?
no vrowser error - just missing styles becasue of tailwind
in network i see errors in get related to that
Can you share a screenshot of that network tab?
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
You are really running the built in PHP server on production?! That one is meant for local/dev only.
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
The PHP Server is not meant for production. Not filament.
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
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.That’s why I am asking for the screenshot of the network tab 😅
i will sned one mom
idk why i have the warn on tailwind .. i dont remeber exactly what solved it
Um. You are literally missing all scripts. This is not „just tailwind“
hmm
check my sh pls
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?changed it when ?
the sh deletes all and then pulls it and push the .env from anothe env i have
Where is this stuff running? On your local machine or on a remote server?
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
So you need to adjust your
.env
to that servers config.i did it but i ll check it again
Share your env file please.
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 ?
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.
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
If you also have a
ASSETS_URL
you need to change that toodont 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
It should be the same URL you input into the browser to access the root of your Laravel site
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
What?
nothing changed in the GET
here is the same
i tired in 3-4 ways the url
Did you use localhost again as APP_URL?!
no
Whats the comment about localhost:8000 then?! 🤔
i used my server or i user myserver/alias from the conf
127 0 0 1
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
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
No. Remote is not a localhost. As the name implies that’s always the current server.
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 😦 )
problem is Route [login] not defined.
i might be doing something bad on my index, i tried multiple solutions:
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 pagesry, i did revised the code 🙂 i tried with wrong ''' before 🙂
fillament login page is /admin/login , right ?
Do like this for Route [login] problem
ok but if i want under midldleware ?
Route::middleware(['web', 'auth'])->group(function () {
Route::get('/admin', [AdminPanelProvider::class, 'panel'])->name('admin.panel');
No, login page should be outside of 'auth' middleware, because we need to see without authenticate
ah ok got it
You don't need to register any Filament pages. Filament does that for you
what is the auth login path for filalment ? where do i find it ?
{the_path_to_your_panel}/login
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');
}
You have login enabled on your panel right?
->login()
yes