Set resolver for nginx, you probably already have one if you use SSL OCSP stapling 8.8.8.8 are Google's public IPv4 DNS servers.
resolver 8.8.8.8 valid=86400;
resolver_timeout 10;
Place this configuration on your server_block or create some .conf file on /etc/nginx and use include to call it, like you would with global SSL configuration.
Include example:
include cat-error-pages.conf;
Actual code:
recursive_error_pages on;
# all of the status defined at http.cat AND allowed by nginx to be error_page'd
error_page 300 301 302 303 304 305 307 400 401 402 403 404 405 406 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 425 426 429 431 444 450 451 500 501 502 503 506 507 508 509 599 /status-cats-error.html;
location /status-cats-error.html {
proxy_pass https://http.cat/$status;
}