Laravel api.php - the GET method is not supported for route
18:11 18 Oct 2023

I made a website on a local computer, after transferring it to the server and https API requests stopped working

routes/api.php

Route::post('/shop/search', SearchController::class);

call this url:

https://server.example/api/shop/search

Unit tests work for post requests , but requests from Postman or other utilities display an error { "message": "The GET method is not supported for route api/shop/search. Supported methods: POST." }

If I change in api.php to get method - it works.

Tried various solutions that I found on this topic, but still post requests are not processed over HTTPS.

In Postman I don’t confuse post and get request.It would be too obvious. Moreover, I use 3-4 different HTTP clients

Added disabling csrf token verification in \App\Http\Middleware\VerifyCsrfToken.php for all routes '*'

There is no redirect on the nginx server, I checked with a request from the browser, it can also send post requests

Every time cleared the cache from console php artisan optimize:clear

By default add Content-Type and Accept application/json request headers

php artisan route:list it is not resourceful route, its regular

POST api/shop/search ..................... Api\Shop\SearchController

laravel