I have a front-end running on Nuxt and Laravel as a back-end service. When I generate the signedURL using the Laravel's API middleware - the path includes "api" in the URL, resulting into a page not found exception on the Nuxt side
So, here are the steps to better understand what's happening:
$signedUrl = URL::signedRoute('register', ['email' => $this->request->email, 'group_id' => $this->request->group_id], null, false);
http://localhost:3000/api/register?email=ss%40gmail.com&group_id=2&signature=ce4fba05bf5ccae6ea20a6043a47ca11de603238214deda7202d19f2989272cb
Is there a way to get rid of the /api/ from the generated URL? I've tried setting 4th param (absolute) in the method signedRoute to false, but it doesn't help.
The default api routes have prefix 'api' as seen in your RouterProvider:
protected function mapApiRoutes()
{
Route::prefix('api')
...;
}
When you generate the signed URL, for your route 'register'
which is using the prefix api
, the generated URL will be as expected: www.mydomain.com/api/register?...