Skip to content

REST API returns HTML for 404 and other errors  #1859

@ZhangYiJiang

Description

@ZhangYiJiang

Describe the bug

Currently our API sits behind nginx, which means any errors such as 404 will return a HTML error page. This is somewhat awkward, as the rest of the API is in JSON. For consistency we should improve the error page.

At the very least it should consistently return an application/json file for errors, and as a stretch goal we can do what Django REST server does and use accept to distinguish between API users and browsers, and show a nice HTML error page only if the user is visiting the page using a browser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiAPI servers and scrapers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions