Return 502 + json when original server offline


#1

I have two domains:

example.com
api.example.com

I need return 502 + json (not html custom page) for api.example.com when my api server offline. My clients expect to receive json, not HTML.

Example:

Status Code: 502
Response: {"jsonrpc": "2.0", "id": 0, "error": {"code": -3200, "message":"Bad Gateway"}}

What can I do in this case? My cloudflare plan “Pro”.

Thank you!


#2

This topic was automatically closed after 14 days. New replies are no longer allowed.