Sending POST returns 405 while my routes are OK
I have a weird problem. I try to log in with POST (username/password) to my application with this route
Route::post('login', 'AuthController@postLogin')->name('login.post');
I get a 405
The POST method is not supported for this route. Supported methods: GET, HEAD
In the local development environment everything is fine. In a production server environment I get this error.
I use Postman fos testing.
This is my route list
- GET|HEAD | /
- GET|HEAD | domains
- GET|HEAD | login
- POST | login
- GET|HEAD | research-programs
- GET|HEAD | researchers
- GET|HEAD | researchers/profile
- PUT | researchers/profile
- POST | researchers/profile/picture
- GET|HEAD | researchers/random
- GET|HEAD | researchers/search
- GET|HEAD | researchers/{id}
- PUT | researchers/{id}
- POST | researchers/{id}/picture
- GET|HEAD | units
I added a GET /login route and dumped the \Illuminate\Http\Request object to see what I got.
These lines tell me that there is a redirect?
"REDIRECT_REDIRECT_REDIRECT_STATUS" => "200"
"REDIRECT_REDIRECT_REDIRECT_UNIQUE_ID" => "ZQ27NKn65K-juEgBrlpqKgAAAMw"
"REDIRECT_REDIRECT_REDIRECT_URL" => "/login/"
"REDIRECT_REDIRECT_REQUEST_METHOD" => "POST"
"REDIRECT_REDIRECT_REQUEST_SCHEME" => "https"
"REDIRECT_REDIRECT_REQUEST_URI" => "/login/?XDEBUG_SESSION_START=PHPSTORM"
"REDIRECT_REDIRECT_SERVER_PORT" => "443"
"REDIRECT_REDIRECT_SERVER_PROTOCOL" => "HTTP/1.1"
"REDIRECT_REDIRECT_STATUS" => "500"
...
"REDIRECT_REDIRECT_UNIQUE_ID" => "ZQ27NKn65K-juEgBrlpqKgAAAMw"
"REDIRECT_STATUS" => "500"
"REDIRECT_UNIQUE_ID" => "ZQ27NKn65K-juEgBrlpqKgAAAMw"
"REDIRECT_URL" => "/500.shtml"
"REMOTE_PORT" => "54560"
"REQUEST_METHOD" => "GET"
"REQUEST_SCHEME" => "https"
This is my api.php
Route::get('/', function(){
return "welcome";
});
Route::post('/login', 'AuthController@postLogin')->name('login.post');
Route::get('/researchers', 'ResearcherController@allResearchers')->middleware('admin');
Route::get('/researchers/search', 'ResearcherController@searchResearchers');
Route::get('/researchers/random', 'ResearcherController@randomResearchers');
Route::get('/researchers/profile', 'ResearcherController@getOwnData')->middleware('authenticated');
Route::put('/researchers/profile', 'ResearcherController@putOwnData')->middleware('authenticated');
Route::post('/researchers/profile/picture', 'ResearcherController@changeOwnPicture')->middleware('authenticated');
Route::get('/researchers/{id}', 'ResearcherController@getResearcher');
Route::put('/researchers/{id}', 'ResearcherController@putResearcher')->middleware('admin');
Route::post('/researchers/{id}/picture', 'ResearcherController@postResearcherPicture')->middleware('admin');
Route::get('/domains', 'DomainController@getDomains');
Route::get('/faculty-thematics', 'FacultyThematicController@getFacultyThematics');
Route::get('/research-domain-thematics', 'ThematiqueDomaineRechercheController@getThematiqueDomaineRecherche');
Route::get('/research-programs', 'ResearchProgramController@getResearchPrograms');
Route::get('/search-axes', 'SearchAxeController@getSearchAxes');
Route::get('/units', 'UnitController@getUnits');
I've been struggling with this for hours now.
Comments
Post a Comment