1.1.0 • Published 5 years ago

cloudflare-custom-errors v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Cloudflare Custom Static Error Pages

Cloudflare: Configuring Custom Errors and Challanges

Published pages:

::CAPTCHA_BOX::

::CLOUDFLARE_ERROR_1000S_BOX::

Publish changes.

We use GitHub Pages to serve the Next.js statics from the gh-pages branch. This process is automated with the following command:

yarn publish

Creating new pages.

Create a new page in pages.

When it's ready, add it to the exportPathMap in next.config.js.

  exportPathMap: async function () {
    return {
      ...
      "/captcha_box": { page: "/captcha" }
    };
  }

This will export pages/captcha as captcha_box.html

Developing

While developing it's handy to have an idea of what the inject content from Cloudflare might look like, instead of just the string tag ::EXAMPLE_OF_A_CLOUDFLARE_TAG::

Run yarn dev and open at localhost:3000 using the links there will add a preview query to the url. We can use that while developing to have a visual representation on what COULD be injected through the tag - be aware though that this might become out dated.

See the default error pages from Cloudflare here: http://cloudflarepreview.com/