Repository navigation
Api group 404 not found #1768
Description
Activity
Hey, can you please post your http Kernel.php file?
@fredroo Do you mean API_DOMAIN, right? @specialtactics This problem cause sometimes. I really want to know for where to debug or checking first.
In my case when I using same configuration, but different environment, domain etc.
Domain is the one factor to made route always return 404, right?
Is it possible to share dingo API logic for routing?
Thanks for your suggestion @fredroo. My case depends on the configuration of the server, but it can end the problem as you mentioned. Normally I using Nginx for proxy and API_DOMAIN related to the internal proxy_pass such as order-service, payment-service. When I try to change to use Ingress Nginx Controller API_DOMAIN should replace by a real domain.
Hopefully, this helps someone fix your problem.
Thanks @fredroo indeed it was the issue
Hey @ALTELMA
Is it possible to share dingo API logic for routing?
Yes, this logic is in the code which is shared via this repository 😛
Reacted by Phongthorn@specialtactics , I am also facing the same issue. I am getting 404 error for my API routes. Other routes are working fine.
"php artisan api:routes" command would list all API routes, but those returning 404. Any suggestion would be appreciated.
I am using below configuration values in my .env file
API_PREFIX=
API_DOMAIN=localhostMy kernal.php file is below,
protected $middleware = [
//\Fruitcake\Cors\HandleCors::class,
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],'api' => [ // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 'throttle:api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ];protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];@RajuPuthen plz post your HTTP kernel file and env file and what is the URL you are using to access them.
1223/5000
Actual behavior
api.php
$api = app('Dingo\Api\Routing\Router');
$api->group(["version"=>"v1","namespace"=>"\App\Http\Controllers\Admin","prefix"=>"admin"], function ($api) {
$api->get("login","LoginController@login")->name("admin.login");
});
404 not found
sail@caca0a954c1f:/var/www/html$ php artisan api:routes
+------+----------+-------------+-------------+--------------------------------------------------+-----------+------------+----------+------------+
| Host | Method | URI | Name | Action | Protected | Version(s) | Scope(s) | Rate Limit |
+------+----------+-------------+-------------+--------------------------------------------------+-----------+------------+----------+------------+
| | GET|HEAD | admin/login | admin.login | App\Http\Controllers\Admin\LoginController@login | No | v1 | | |
+------+----------+-------------+-------------+--------------------------------------------------+-----------+------------+----------+------------+