Search code examples
laravelapidigital-oceanlaravel-forge

Getting GET error while sending POST request to the POST route in Laravel API


Locally project runs fine. On the server getting this error while sending POST request to the POST route in Laravel 9 API.

"message": "The GET method is not supported for this route. Supported methods: POST."

My route from the api.php routes file:

Route::post('/userdata/create', [UserDataController::class, 'createAccount']);

My route from the routes list (from php artisan route:list):

POST       api/v1/userdata/create .......... Api\V1\UserDataController@createAccount

Tried:

php artisan cache:clear
php artisan route:cache
php artisan route:clear

Didn't fixed it yet.


Solution

  • The solution to that problem was actually very simple:

    I needed to send POST request to "https" url, and i was sending it to "http" url.

    Still strange that server was complaining that GET method is used...