PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved

token query fails

Solved
jetsetwilly

Jun 9th, 2025 08:01 AM

Hi, calling /api/token?key= fails. The error is: /httpdocs/public/api/token" failed (2: No such file or directory). Any ideas? Tx

bobbyiliev

Jun 9th, 2025 10:44 PM

Best Answer

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

jetsetwilly

Jun 9th, 2025 11:49 PM

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
jetsetwilly

Jun 10th, 2025 04:41 AM

It looks like nginx is converting the POST into a GET for some reason

jetsetwilly

Jun 10th, 2025 05:30 AM

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!

Report
1
bobbyiliev

Jun 10th, 2025 07:44 AM

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