LoginSignup
15
15

More than 5 years have passed since last update.

nginx エラーページでjsonを返す方法

Posted at

  error_page 400 404 405 =200 @40*_json;

  location @40*_json {
    default_type application/json;
    return 200 '{"code":"1", "message": "Not Found"}';
  }

  error_page 500 502 503 504 =200 @50*_json;

  location @50*_json {
    default_type application/json;
    return 200 '{"code":"1", "message": "Unknown Error"}';
  }
15
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
15