If the route is defined as a POST, it is not possible for it to appear as a GET. Check your route definition and use php artisan route:list to check the defined routes. No need to mess about with permissions as this won't affect your routes.
Laravel 9 POST Route Appears as GET Instead of POST
I'm encountering an issue in Laravel 9 where I have defined a route with the POST method, like so: //Route Route::post('receive-waiver', ReceiveWaiverController::class);
However, when I tested this route, I noticed that in the developer tools network tab, the request appears as a GET method instead of a POST. Consequently, I receive an error message stating: "The GET method is not supported for route 'receive-waiver'. Supported methods: POST."
The request must be accessing the URL only for the purpose of this URL for webhook. The webhook sender is from another app and I don't have control of their codes.
I'm perplexed by this behavior, as I've clearly defined the route as a POST route. Can anyone help me understand why this is happening and provide guidance on how to resolve it? I want to ensure that my 'receive-waiver' route is accessed using the correct HTTP method, which should be POST. Thank you in advance for your assistance!
PS: Before testing, I run these commands:
composer dump-autoload, chown -R www-data:www-data ., chmod -R 775 ., #php artisan migrate, php artisan config:cache, php artisan route:cache, php artisan route:clear, php artisan cache:clear, php artisan view:clear, php artisan optimize, php artisan queue:restart,
@rommeltraya25 This error is caused because your method of testing is flawed, not because there is anything wrong with the route.
If you want to test it locally you must use a program like postman
By the way, if the third party wants to send POST (and this would he normal) then you need to EXCLUDE the route from CSRF validation by adding into the except array in verifyCSRF middleware
Please or to participate in this conversation.