- Add daily request limit per IP in blacklist settings (1-1,000,000/day) - Refactor access control logic: merge blacklist and rate limit checks - Remove RATE_LIMIT_API_DAILY_REQUESTS env var, use database config instead - Move x-custom-auth check earlier in middleware chain - Add comprehensive English documentation (31 new guide pages) - Improve code structure and error handling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
5.5 KiB
Cloudflare Workers Backend
[!warning] Note The
worker.devdomain is not accessible in China, please use a custom domain.
-
Click
Compute (Workers)->Workers & Pages->Create -
Select
Worker, clickCreate Worker, modify the name and then clickDeploy -
Go back to
Workers & Pages, find the worker you just created, clickSettings->Runtime, modifyCompatibility flags, manually addnodejs_compat, and the compatibility date also needs to be later than the date shown in the image. -
Download worker.js
-
Go back to
Overview, find the worker you just created, clickEdit Code, delete the original file, uploadworker.js, and clickDeployNote
To upload, first click Explorer in the left menu, then right-click in the file list window and find
Uploadin the context menu, please refer to the screenshots belowReference: issues156
-
Click
Settings->Variables and Secrets, add variables as shown in the image[!NOTE] Note For more variable configuration, please see Worker Variables Documentation
Note that the outermost quotes are not needed for string format variables
For
USER_ROLES, please configure in this format:[{"domains":["awsl.uk","dreamhunter2333.xyz"],"role":"vip","prefix":"vip"},{"domains":["awsl.uk","dreamhunter2333.xyz"],"role":"admin","prefix":""}]Recommended variable list
Variable Name Type Description Example PREFIXText Default prefix for new email names, can be omitted if no prefix needed tmpDOMAINSJSON All domains for temporary email, supports multiple domains ["awsl.uk", "dreamhunter2333.xyz"]JWT_SECRETText/Secret Secret for generating JWT, JWT is used for login and authentication xxxADMIN_PASSWORDSJSON Admin console password, console access not allowed if not configured ["123", "456"]ENABLE_USER_CREATE_EMAILText/JSON Whether to allow users to create emails, not allowed if not configured trueENABLE_USER_DELETE_EMAILText/JSON Whether to allow users to delete emails, not allowed if not configured true -
Click
Settings->Bindings, clickAdd Binding, enter the name as shown, select the D1 database you just created, and clickAdd Binding[!NOTE] Important Note that the binding name for
D1 Databasehere must beDB -
Click
Settings->Triggers, here you can add your own domain, or you can use the automatically generated*.workers.devdomain. Record this domain, as it will be needed when deploying the frontend later.Note
Open the
workerurl, if it displaysOK, the deployment is successfulOpen
/health_check, if it displaysOK, the deployment is successful -
If you want to enable the user registration feature and need to send email verification, you need to create a
KVcache. You can skip this step if not needed.[!NOTE] Important If you want to enable the user registration feature and need to send email verification, you need to create a
KVcache. You can skip this step if not needed.Note that the binding name for
KVhere must beKVClick
Storage & Databases->KV->Create Namespace, as shown in the image, clickCreate NamespaceThen click
Settings->Bindings, clickAdd Binding, enter the name as shown, select the KV you just created, and clickAdd Binding -
Telegram Bot Configuration
Note
If you don't need Telegram Bot, you can skip this step
Please first create a Telegram Bot, then get the
token, add thetokentoVariables and Secrets, variable name:TELEGRAM_BOT_TOKEN -
If you want to use the scheduled task to clean emails in the admin page, you need to add a scheduled task in
Settings->Trigger Events->Cron Triggers.Note
Select
cronexpression, enter0 0 * * *(this expression means run daily at midnight), clickAddto add. Please adjust this expression according to your needs.













