Skip to main content

A customizable Cloudflare error page generator

Project description

Cloudflare Error Page Generator

What does this project do?

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

Quickstart

Install cloudflare-error-page using pip

pip install git+https://github.com/donlon/cloudflare-error-page.git

Then you can generate an error page based on parameters you like. (See example.py)

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": 'Not Working',
    },
    # Host status is also ok
    'host_status': {
        "status": 'ok',
        "location": 'example.com',
    },
    # can be 'browser', 'cloudflare', or 'host'
    'error_source': 'cloudflare',

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

with open('error.html', 'w') as f:
    f.write(error_page)

webbrowser.open('error.html')

Default error page

More Examples

Catastrophic infrastructure failure

params =  {
    'title': 'Catastrophic infrastructure failure',
    'more_information': {
        "text": "cloudflare.com",
        "link": "https://youtube.com/watch?v=dQw4w9WgXcQ",
    },
    'browser_status': {
        'status': 'error',
        'status_text': 'Out of Memory',
    },
    'cloudflare_status': {
        'status': 'error',
        'location': 'Everywhere',
        'status_text': 'Not Working',
    },
    'host_status': {
        'status': 'error',
        'location': 'example.com',
        'status_text': 'On Fire',
    },
    'error_source': 'cloudflare',
    'what_happened': '<p>There is a catastrophic failure.</p>',
    'what_can_i_do': '<p>Please try again in a few years.</p>',
    'perf_sec_by': {
        "text": "Cloudflare",
        "link": "https://youtube.com/watch?v=dQw4w9WgXcQ",
    },
}

Catastrophic infrastructure failure

Web server is working

params = {
    'title': 'Web server is working',
    'error_code': 200,
    "more_information": {
        "hidden": True,
    },
    'browser_status': {
        'status': 'ok',
        'status_text': 'Seems Working',
    },
    'cloudflare_status': {
        'status': 'ok',
        'status_text': 'Often Working',
    },
    'host_status': {
        'status': 'ok',
        'location': 'example.com',
        'status_text': 'Just Working',
    },
    'error_source': 'host',
    'what_happened': '<p>This site is still working. And it looks great.</p>',
    'what_can_i_do': '<p>Visit the site before it crashes someday.</p>',
}

Web server is working

Full Parameter Reference

{
    "html_title": "cloudflare.com | 500: Internal server error",
    "title": "Internal server error",
    "error_code": 999,
    "time": "2025-11-18 12:34:56 UTC",  // if not set, current UTC time is shown

    // Configuration for "Visit ... for more information" line
    "more_information": {
        "hidden": false,
        "text": "cloudflare.com", 
        "link": "https://youtube.com/watch?v=dQw4w9WgXcQ",
    },

    // Configuration for the Browser/Cloudflare/Host status
    "browser_status": {
        "status": "ok", // "ok" or "error"
        "location": "You",
        "name": "Browser",
        "status_text": "Working",
        "status_text_color": "#9bca3e",
    },
    "cloudflare_status": {
        "status": "error",
        "location": "Cloud",
        "name": "Cloudflare",
        "status_text": "Not Working",
        "status_text_color": "#bd2426",
    },
    "host_status": {
        "status": "ok",
        "location": "The Site",
        "name": "Host",
        "status_text": "Working",
        "status_text_color": "#9bca3e",
    },
    "error_source": "host", // Position of the error indicator, can be "browser", "cloudflare", or "host"

    "what_happened": "<p>There is an internal server error on Cloudflare's network.</p>",
    "what_can_i_do": "<p>Please try again in a few minutes.</p>",

    "ray_id": '0123456789abcdef',  // if not set, random hex string is shown
    "client_ip": '1.1.1.1',

    // Configuration for 'Performance & security by ...' in the footer
    "perf_sec_by": {
        "text": "Cloudflare",
        "link": "https://youtube.com/watch?v=dQw4w9WgXcQ",
    },
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudflare_error_page-0.0.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file cloudflare_error_page-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudflare_error_page-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26590b6afa55b77cf897ceea9ed6be1d9629a501fecaa1f6c56f05bdd15b04f5
MD5 e815457750cb258ad095c6d113d7091a
BLAKE2b-256 320a9cbb69ee94cfc0c151a972ab501beb38caa8be19314d0e8c6bd7d6c90338

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page