Skip to content

Instantly share code, notes, and snippets.

@hgranillo
Created July 12, 2017 15:16
Show Gist options
  • Save hgranillo/84cf9d04b7402b063d455d8147a37688 to your computer and use it in GitHub Desktop.
Save hgranillo/84cf9d04b7402b063d455d8147a37688 to your computer and use it in GitHub Desktop.
https://http.cat/ error pages for nginx

Nginx.conf

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;

Error pages

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment