A set of elegant, out-of-the-box Cloudflare WAF Custom Page Templates implemented using Next.js, Tailwind CSS, and HeroUI. Built with Next.js 15, TypeScript, and Tailwind CSS, featuring responsive design, dark mode support, and automatic Cloudflare variable replacement.
English | ็ฎไฝไธญๆ | Online Demo
Tip
Please comply with the project's Open Source License when making modifications.
- ๐จ Modern Responsive Design: Sleek and contemporary layout optimized for all devices.
- ๐ Dark Mode Support: Automatically adapts to system preferences for comfortable viewing.
- ๐ Full Coverage of Cloudflare Page Types:
Block
: WAF interception pagesError
: 1000s / 500s error pagesCaptcha
: CAPTCHA challenge pages
- ๐ฑ Mobile-First Approach: Guaranteed smooth experience on mobile devices.
- ๐ญ Automatic Cloudflare Variable Replacement: Seamless integration of Cloudflare-specific variables.
- Next.js 15 + React 19
- HeroUI v2 + Tailwind CSS v3
- TypeScript
Currently supported automatic variable replacements:
::CLIENT_IP::
- Client IP Address::RAY_ID::
- Cloudflare Ray ID::GEO::
- Client Geolocation::CLOUDFLARE_ERROR_500S_BOX::
- 500s Error Page Component::CLOUDFLARE_ERROR_1000S_BOX::
- 1000s Error Page Component::CAPTCHA_BOX::
- Cloudflare CAPTCHA Component::IM_UNDER_ATTACK_BOX::
- Cloudflare JavaScript Challenge Component
Quickly access Cloudflare Custom Pages via this link.
Tip
Your Cloudflare zone must be on Pro plan or higher to use these templates.
Type | Subtype | Link |
---|---|---|
Error Pages | Server Errors (500s) | Import Link |
CF 1000s Errors | Import Link | |
Block Pages | IP Block (1006) | Import Link |
WAF Block (1010) | Import Link | |
Rate Limit Block (429) | Import Link | |
Challenges | Interactive Challenge | Import Link |
Managed Challenge (I'm Under Attack Modeโข) | Import Link | |
Country/Region Challenge | Import Link | |
JavaScript Challenge | Import Link |
-
Deploy to Vercel (Recommended):
-
Manual Deployment:
bun run build # Ignore the following command if using Nginx/etc. bun run start
bun run start
launches a local server usingserve@latest
, listening on0.0.0.0:3001
by default.
-
Install Bun:
# macOS/Linux: curl -fsSL https://bun.sh/install | bash # Windows PowerShell: powershell -c "irm bun.sh/install.ps1 | iex"
-
Clone Repository:
git clone https://github.com/Alice39s/cloudflare-custom-pages-nextjs.git
-
Install Dependencies:
bun install
-
Start Dev Server:
bun dev
-
Build Production Version:
bun run build
Modify fields in ./config/site.ts
(name, description, etc.).
Translations of all texts can be modified in . /config/i18n.ts
to change the translation of all texts (TODO: multi-language support).
To change the page text, edit . /config/i18n.ts
:
export const blockPageTranslations = {
ip: {
title: "Access Denied - IP Blocked",
message: "The owner of this website has banned your IP address.",
},
// ... more translations
};
To modify page configurations (without text content), edit ./config/routes.ts
:
export const blockPages = {
ip: {
type: "ip",
code: "1006",
icon: "shield-ban",
networkStatus: {
clientStatus: "error",
edgeStatus: "success",
},
},
// ... more configurations
};
Project structure:
components/
โโโ cf/ # ๐ฉ๏ธ Cloudflare Components
โโโ home/ # ๐ Homepage Components
โโโ layout/ # ๐ผ๏ธ Global Layout Components
This project utilizes the lucide-react
icon library. To optimize the project's size, we have encapsulated a unified entry point and on-demand loading component called Icon
.
You can follow the steps below to add or replace icons:
-
Check if the icon you want to use is not already listed in
./config/icons.ts
. If it exists, skip directly to step 5. -
Visit the Lucide icon library and select your preferred icon.
-
Click the
Copy Component Name
button to copy the icon's name. -
Then, navigate to
./config/icons.ts
and follow the instructions to add the icon name to:import { ... Component } from "lucide-react"
(import the icon component)export type IconKey = ...
(add the icon name to the type list)export const icons = { ... }
(add the icon name to the mapping dictionary)
-
Finally, use the desired icon in
./config/routes.ts
.
Licensed under GPL v3.0. See LICENSE for details.