Errordoc Directives - Configure - H2O - the optimized HTTP server

# H2O

the optimized HTTP/1.x, HTTP/2, HTTP/3 server

×
Powered by Oktavia

## Configure > Errordoc Directives

This document describes the configuration directives of the errordoc handler.

- `error-doc`

### `"error-doc"`

Description:

  Specifies the content to be sent when returning an error response (i.e. a response with 4xx or 5xx status code).

  The argument must be a mapping containing following attributes, or if it is a sequence, every element must be a mapping with the following attributes.

  - `status` - three-digit number indicating the status code (or sequence of that from version 2.3)
  - `url` - URL of the document to be served

  URL can either be absolute or relative. Only `content-type`, `content-language`, `set-cookie` headers obtained from the specified URL are served to the client.

  Example. Set error document for 404 status

      error-doc:
        status: 404
        url: /404.html

  Example. Set error document for 500 and 503 status

      error-doc:
        - status: 500
          url: /internal-error.html
        - status: 503
          url: /service-unavailable.html

  Example. Set error document for 50x statuses (From version 2.3)

      error-doc:
        status: [500, 502, 503, 504]
        url: /50x.html

Level:
  global, host, path, extension