srajiv9496's avatar

The POST method is not supported for this route. Supported methods: GET, HEAD.

Currently I'm working on a attendance management system and the project is working properly when running locally but when trying to live my project using Hostinger then I'm facing the error as:

The POST method is not supported for this route. Supported methods: GET, HEAD.

And I've watched and read every article on the internet but couldn't help myself. Even though the project is working on my local system.

0 likes
8 replies
martinbean's avatar

@srajiv9496 Well the error message clearly states you’re trying to do a POST request to a URI that is only expecting GET requests. So check the network tab in your browser console. It’s probably a HTTP-to-HTTPS redirect or something.

srajiv9496's avatar

@martinbean Thank you for the reply. In network tab all i'm getting is network error 404. Nothing is being loaded except the plain html.

Abubakar_Iqbal's avatar

Try with change the post method above the get route. May this change will fix your issue.

maxxxir's avatar

well if you're not making an obvious mistake like sending post request for a get route

it's usually something wrong with your nginx/webserver configuration

maxxxir's avatar

@srajiv9496 send a request to the route with post man and set the header Accept : application/json

amd check the response also see postman console
it will show if you have a exception or it's being redirected

srajiv9496's avatar

@maxxxir Thank you for your help and now the problem is solved. But till date I donot know what was the issue as I rewrote those routes there wasn't any error.

Snapey's avatar

It could be due to previously having returned a view in response to a POST request. Always return a redirect instead.

Basically Laravel gets confused when there is a validation error and it should return back()

Please or to participate in this conversation.