Skip to content

Allow API Routes to work without trailing slashes #1297

@vlebert

Description

@vlebert

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

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

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions