token query fails
Hi, calling /api/token?key= fails. The error is: /httpdocs/public/api/token" failed (2: No such file or directory). Any ideas? Tx
Hey!
It looks like you're getting this error because the request is hitting the wrong path: /httpdocs/public/api/token
which usually means the server is misconfigured and including the public
folder in the URL, which it shouldn't.
Your server should point to the public
folder as the document root, but the URL should just be /api/token
and not /public/api/token
.
Also, just for your info, if you run:
php artisan route:list | grep 'api/token'
You'll see that it's a POST
route, not GET
, so make sure your request is using POST
and not GET
.
A couple quick questions to help debug:
- Are you testing this in the browser or using something like Postman?
- What does your web server config look like? (especially the document root)
- Are you running Laravel in a subfolder or directly from the domain root?
- What webserver and setup do you have exactly?
- Bobby
Hi Bobby,
Thank you for your response.
- I am using plesk laravel toolkit as a automated ci/cd deployment platform: https://www.plesk.com/extensions/laravel/
- Root folder is httpdocs, this is where it was installed by plesk as module
- Was using Insomnia for the test
Looks like nginx is routing the requests to the public folder but should route to root folder?
- Andreas
It looks like nginx is converting the POST into a GET for some reason
Now its working. Have to specify www.domain.com/api/token instead of domain.com/api/token to avoid nginx redirects. Thanks again for your help Bobby!
















Ah nice! Happy to hear that you've got it working!