Reputation: 2939
When I try to access a page I get MethodNotAllowedHttpException. This used to work, but can't figure out what I did to break it.
routes.php
Route::post('api', ['middleware' => 'api', 'uses' => 'DeviceController@api']);
DeviceController.php
public function api()
{
return view('api');
}
api.blade.php (I have altered api.blade.php to rule it out as the source of the problem.)
<?php echo 'test'; ?>
app/Http/kernal.php
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
],
'api' => [
'throttle:60,1',
'auth:api',
],
];
config/auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'devices',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
'devices' => [
'driver' => 'eloquent',
'model' => App\Device::class,
],
],
app/Providers/RouteServiceProvider.php
public function map(Router $router)
{
$router->group([
'namespace' => $this->namespace,
], function ($router) {
require app_path('Http/routes.php');
});
}
I am using postman to simulate POST requests.
Upvotes: 0
Views: 201
Reputation: 2939
I figured out the problem. I am forcing a secure connection with the .htaccess file while trying to use http.
Upvotes: 1