qfieldcloud icon indicating copy to clipboard operation
qfieldcloud copied to clipboard

Allow API Routes to work without trailing slashes

Open vlebert opened this issue 3 months ago • 2 comments
trafficstars

What is the bug or the crash? What were your expectations and what actually happened?

I recently encountered an issue with the Qfield Cloud API routes, specifically the login routes. It appears that the API routes do not work correctly unless a trailing slash is included at the end of the URL. This inconsistency caused me to spend a significant amount of time troubleshooting why my configuration on n8n, only to discover that the issue was simply the absence of a trailing slash.

Expected Behavior:

API routes should function consistently whether or not a trailing slash is included at the end of the URL. This would make the API more user-friendly and reduce the likelihood of configuration errors.

Current Behavior:

API routes, particularly the login routes, do not work if the trailing slash is omitted. This leads to unnecessary troubleshooting and configuration issues.

Steps to reproduce the issue

This works:

curl -X 'POST' \
  'https://app.qfield.cloud/api/v1/auth/token/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "****",
  "password": "****"
}' 

This gives 405 API Error

curl -X 'POST' \
  'https://app.qfield.cloud/api/v1/auth/token' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "****",
  "password": "****"
}' 

Version

Not relevant

Operating system name

MacOs

Operating system version

Not relevant, using the cloud version

Reinstall QFieldCloud

  • [x] I have a fresh install of the latest QFieldCloud version, but the problem persists.
  • [x] I have the latest available Docker engine installed on my machine.
  • [x] Problem can be reliably reproduced, doesn't happen randomly.

Additional context

No response

vlebert avatar Jul 31 '25 07:07 vlebert