Skip to content

CORS preflight OPTIONS request to API returns 404 #5724

Closed
@salcedo

Description

@salcedo
  • Gitea version (or commit ref): 1.6.1
  • Git version: 2.20.1
  • Operating system: OpenBSD 6.4
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

I'm working on a project that will make some requests to Gitea's API. As my project is on a different origin, my browser sends a CORS preflight (an OPTIONS request).

Gitea doesn't handle an OPTIONS request, and returns 404.

How to fix?

Works:

curl -X GET https://git.example.com/api/v1/repos/search

Returns 404:

curl -X OPTIONS https://git.example.com/api/v1/repos/search

Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/enhancementAn improvement of existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions