(SOLVED) Help debugging a very uninformative error

I’m have a Kirby 4.7.2 app that is deployed to a server with Dokku and the public folder setup. I am also using Getting Started – Kirby Tools v4.0.2 and kql.

Everything works perfectly locally, and was working perfectly on a remote dev instance with a dev domain, but once we moved to a live domain, I keep getting an error at the headless and also kql endpoints except for root:

{
    "title": "Error",
    "description": "",
    "content": []
}

For some reason the path at / works, and somehow it seems all the single path routes just return the data from /.

However, any subdirectory such as /contributors/posts fail with the above error.

I am at quite a loss since it worked before only setting a new domain name and works perfectly locally. I’ve also flushed the media/cache folders to no avail.

Oddly enough I even have "debug" => true in the config and the dokku logs show nothing, just the request to the endpoint

I don’t think this response comes from Kirby as the structure (title, description and content keys) doesn’t look familiar. Are you sure that Dokku actually routes these requests to Kirby?

Ah thanks for the response it did provoke me to look more closely to realize that the response was coming from the Kirby Headless plugin: GitHub - johannschopplich/kirby-headless: 🦭 Kirby, but headless first with bearer token authentication and KQL utilities

After building in more logging I realized it was due to a trailing / in the frontend app’s api url environment var causing 404s on all requests except home :man_facepalming:

Odd that // would work but //anypath would return / and //any/path was a pure 404