Skip to content

Implement json error pages #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davispuh
Copy link
Contributor

@davispuh davispuh commented Aug 9, 2024

Implement json error pages.
This is useful when JSON backend/API doesn't have nice error info and might return blank page.

To use with Nginx:

map $http_accept $errorExtension
{
    default                    html;
    ~application/json          json;
    ~application/activity+json json;
}


error_page 400 /ErrorPages/HTTP400.$errorExtension;
error_page 401 /ErrorPages/HTTP401.$errorExtension;
error_page 403 /ErrorPages/HTTP403.$errorExtension;
# ...

This will cause that when client has Accept: application/json header then it will get JSON response.

@davispuh
Copy link
Contributor Author

Ping? Could you merge my PRs?

@davispuh
Copy link
Contributor Author

What about this one?

@AndiDittrich
Copy link
Member

tldr: technically out of scope

@davispuh
Copy link
Contributor Author

How so? I need a solution to handle all error pages even for JSON APIs and this looks like best tool. It doesn't make sense to have separate tool just for JSON when this could do it all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants