mardi 2 mars 2021

Render JSON as error_page for nginx

I'm currently using nginx/1.14.1 and when my server received error 500 I would like nginx to render json with custom content.

error_page 500 /error.json

location = /error.json {
 ssi on;
 internal;
 auth_basic off;
 root /tmp/errors;
}

then on my /tmp/errors/error.json

 { status: { code: 500, message: 'Internal Server Error' } }

I know that I can handle a custom html but can I render a custom json?




Aucun commentaire:

Enregistrer un commentaire