donlon /cloudflare-error-page

✅Browser ❌Cloudflare ✅Host — Generator for customized Cloudflare error pages. (unofficial)

★ 5,792⑂ 285👁 7⑃ 6● 5▤ 0
HTMLMITCreated 2025-11-19magicalforest.io/cferr/editor/
+0
日增长
5,792
stars
285
forks
7
watchers
6
prs
5
issues
0
releases

README

Cloudflare Error Page Generator

 What does this project do?

This project creates customized error pages that mimic the well-known Cloudflare error page. You can also embed it into your own website.

 Online Editor

Here's an online editor to create customized error pages and example server apps. Try it out here.

!Editor

 Quickstart for Programmers

 JavaScript/NodeJS

Install the cloudflare-error-page package using npm:

 Bash
npm install cloudflare-error-page


The following example demonstrates an Express application that automatically handles server errors.

 JavaScript
import express from 'express';
import { render as render_cf_error_page } from 'cloudflare-error-page';

const app = express();

app.get('/', (req, res) = {
  / Some code that break prod. Pushed by a new employee recently. /
  let [feature_values, _] = features
    .append_with_names(self.config.feature_names)
    .unwrap();
}

app.use((err, req, res) = {
  / Handle the error intelligently by using a custom handler /
  res.status(500).send(render_cf_error_page({
    "title": "Internal server error",
    "error_code": "500",
    "what_happened": err.toString(),
    "what_can_i_do": "Please try again in a few minutes.",
  }));
});

app.listen(3000);


(Thanks @junduck for creating the original NodeJS version.)

 Python

Install cloudflare-error-page using pip.

 Bash
pip install cloudflare-error-page


Then an error page can be generated using the render function provided by the package. (example.py)

 Python
import webbrowser
from cloudflare_error_page import render as render_cf_error_page

 This function renders an error page based on the input parameters
error_page = render_cf_error_page({
     Browser status is ok
    'browser_status': {
        "status": 'ok',
    },
     Cloudflare status is error
    'cloudflare_status': {
        "status": 'error',
        "status_text": 'Error',
    },
     Host status is also ok
    'host_status': {
        "status": 'ok',
        "location": 'example.com',
    },
     Position of the error indicator, valid options are 'browser', 'cloudflare', and 'host'
    'error_source': 'cloudflare',

     Texts shown in the bottom of the page
    'what_happened': 'There is an internal server error on Cloudflare\'s network.',
    'what_can_i_do': 'Please try again in a few minutes.',
})

 Write generated webpage to file
with open('error.html', 'w') as f:
    f.write(error_page)

 Open the generated page in browser
webbrowser.open('error.html')


A demo server using Flask is available in flask_demo.py, and you can also see live demo here. 

 More Examples

 Catastrophic infrastructure failure

 Python
params = {
    "title": "Catastrophic infrastructure failure",
    "more_information": {
        "for": "no information",
    },
    "browser_status": {
        "status": "error",
        "status_text": "Out of Memory",
    },
    "cloudflare_status": {
        "status": "error",
        "location": "Everywhere",
        "status_text": "Error",
    }

Top issues

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON