I am getting a 403 Forbidden when I try to POST data to an api route (live and including postman) while I have the route defined in my api routes file in laravel 6. When I send data via GET (PUT or any other method) it works with http status 200 being returned but POST returns 403. Important to Note is that the expected JSON response is being returned but the http status is wrong (it results in some phone not being able to correctly read the response)
Route::namespace('Api')->prefix('android')->group(function () {
Route::any('getSettings', 'PhoneController@getSettings')->name('phone.getSettings');
});
Above is the route definition while the method is as below in the PhoneController is as below
public function getSettings(Request $request)
{
Log::info('PM SETTINGS GET:'.
" HEADERS: " . json_encode($request->headers->all()) .
" REQUEST: " . json_encode($request->toArray()) .
" BODY: " . json_encode($request->getContent()));
$outputjsonobject = [
'ForceWifiOnForRecordUpload' => PhoneMonitorSetting::$defaultForceWifiOnForRecordUpload,
'ServerTalkInterval' => PhoneMonitorSetting::$defaultServerTalkInterval
];
return response(json_encode($outputjsonobject,JSON_PRETTY_PRINT | JSON_FORCE_OBJECT),200);
}
This error occurs when testing the API on live namecheap server but not on localhost