xalaida / laravel-nuxt-docker

🦾 Dockerized template for your next project with Laravel and Nuxt.
334 stars 103 forks source link

Laravel sanctum 404 not found at /api #10

Closed keedle closed 4 years ago

keedle commented 4 years ago

Hello, When I try to make get request in postman to localhost:8080/api/sanctum/csrf-cookie I'm always getting 404 not found, however, if I change the port to 8081 and remove/api bit it works and gives me 204. Any ideas why that happens ? Thank you.

xalaida commented 4 years ago

Hello, @keedle. All requests without /api prefix are proxied to the nuxt instance, that's why you can't hit sanctum endpoint.

By default, sanctum package uses /sanctum prefix as default. You need to replace that prefix it in the api/config/sanctum.php like this:

'prefix' => 'api/sanctum'

Thanks.

xalaida commented 4 years ago

Note, that you need to prefix all your Laravel routes with api to make them available from the nuxt app, not only sanctum's.

keedle commented 4 years ago

Thank you for help, kinda missed prefix bit in sanctum's docs. Thank you for such a great docker build.

jishnukb2022 commented 2 years ago

Hello How to fix this issue ? I can't fix -> http://localhost:3000/sanctum/csrf-cookie 404 (Not Found)
createError.js:16 Uncaught (in promise) Error: Request failed with status code 404 at createError (createError.js:16:1) at settle (settle.js:17:1) at XMLHttpRequest.onloadend (xhr.js:66:1)

s17-git commented 1 year ago

Same problem here

hassan1165 commented 1 year ago

same problem here

sharpprahs commented 11 months ago

same problem, when i use prefix my application routes middleware not working