Tích hợp Turnstile, WAF, & Bot Management Integrate Turnstile, WAF, & Bot Management ការរួមបញ្ចូល Turnstile, WAF, & Bot Management
Hướng dẫn chi tiết đồng bộ từ docs Cloudflare — mỗi section có backlink tới đúng vị trí trên trang gốc. Detailed guide synced from Cloudflare docs — each section links to the matching anchor on the official page. មគ្គុទ្ទេសក៍លម្អិតធ្វើសមកាលពី docs Cloudflare — ផ្នែកនីមួយៗមានតំណទៅទីតាំងត្រូវគ្នានៅទំព័រផ្លូវការ។
← Danh mục ← Catalog ← បញ្ជីGiải thích nhanh Quick context បរិបទរហ័ស
Thuộc nhóm Application Services — tập trung bảo vệ, tăng tốc và vận hành ứng dụng/web phía trước origin. Tutorial «Tích hợp Turnstile, WAF, & Bot Management» giúp bạn làm quen luồng triển khai thật — phù hợp đọc trước khi mở tài liệu gốc tiếng Anh. Đọc phần tóm tắt và lưu ý trước — sau đó mở docs gốc để copy lệnh và cấu hình chi tiết.
This tutorial will guide you on how to integrate Cloudflare Turnstile, Web Application Firewall (WAF), and Bot Management. This combination creates a robust defense against various threats, including automated attacks and malicious login attempts.
វគ្គបណ្តុះបណ្តាលនេះនឹងរក្សាទុកអ្នកអំពីការរួមបញ្ចូល Cloudflare Turnstile, Web Application Firewall (WAF) និង Bot Management ។ ការរួមបញ្ចូលទាំងនេះបង្កើតការពារដ៏ស្រស់ស្អាតប្រឆាំងនឹងការជំរុញផ្សេងៗផ្សេងទៀតរួមទាំងការជំរុញដោយស្វ័យប្រវត្តិនិងការធ្វើតេស្តការចុះឈ្មោះដែលមានប្រសិទ្ធិភាព។
Lưu ý Note ចំណាំ
Lưu ý trước khi làm Notes before you start ចំណាំមុនពេលចាប់ផ្តើម
- Đây là bản tóm tắt trên Orange Cloud Learning Hub — không thay thế tài liệu chính thức.
- Luôn mở liên kết «Tài liệu gốc» bên dưới khi cần lệnh CLI, snippet code và ảnh minh họa đầy đủ.
- Docs Cloudflare cập nhật thường xuyên — đối chiếu ngày «Rà soát lần cuối» trên trang gốc khi triển khai production.
- This is a summary on Orange Cloud Learning Hub — it does not replace the official documentation.
- Open the Official docs link below for CLI commands, code snippets, and full screenshots.
- Cloudflare docs change frequently — verify the Last reviewed date on the official page before production use.
- នេះគឺជាការបញ្ជាក់អំពី Orange Cloud Learning Hub — វាគឺជាការផ្លាស់ប្តូរនៃឯកសារផ្លូវការ។
- ចុចតំណភ្ជាប់ Docs Official នៅខាងក្រោមសម្រាប់ការបញ្ជា CLI, សៀវភៅកូដនិងរូបថតពេញលេញ។
- Cloudflare បានផ្លាស់ប្តូរជាធម្មតានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅ។
Tài liệu gốc — rà soát lần cuối: over 1 year ago Official docs — last reviewed: over 1 year ago ឯកសារផ្លូវការ — ពិនិត្យចុងក្រោយ: over 1 year ago
Overview Overview Overview
Phần «Tổng quan» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Overview" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «Overview» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)
Overview Overview Overview
Phần «Tổng quan» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Overview" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «Overview» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- WAF lọc lưu lượng truy cập độc hại dựa trên tín hiệu mạng.
- Bot Management phân tích các yêu cầu để xác định và giảm thiểu các mối đe dọa tự động.
- Turnstile kiểm tra các tín hiệu từ phía khách hàng và trình duyệt để phân biệt giữa người dùng và bot.
- WAF filters malicious traffic based on network signals.
- Bot Management analyzes requests to identify and mitigate automated threats.
- Turnstile examines client-side and browser signals to distinguish between human users and bots.
- WAF កម្រិតខុសគ្នានៃការដឹកជញ្ជូនដោយផ្អែកលើសញ្ញាបនប័ត្របណ្តាញ។
- Bot Management អនុញ្ញាតឱ្យដោះស្រាយតម្រូវការដើម្បីរកឃើញនិងកាត់បន្ថយតម្រូវការដោយស្វ័យប្រវត្តិ។
- Turnstile ពិនិត្យឡើងវិញសញ្ញាបនប័ត្រ client-side និង browser ដើម្បីបែកចាយរវាងអ្នកប្រើប្រាស់បុគ្គលិកនិង bots ។
Trước khi bạn bắt đầu Before you begin មុនពេលដែលអ្នកចាប់ផ្តើម
Phần «Before you begin» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Before you begin" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «មុនពេលដែលអ្នកចាប់ផ្តើម» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- Bạn phải có tài khoản Cloudflare với access đến WAF và Bot Management (nếu sử dụng).
- Một xác thực quản lý tuyến đường hiện có dựa trên JavaScript/TypeScript.
- You must have a Cloudflare account with access to WAF and Bot Management (if using).
- An existing JavaScript/TypeScript-based route handling authentication.
- អ្នកត្រូវតែមានគណនី Cloudflare ជាមួយ access ទៅ WAF និង Bot Management (ប្រសិនបើបានប្រើ).
- ការត្រួតពិនិត្យការត្រួតពិនិត្យដំណើរការដំណើរការដំណើរការដំណើរការដំណើរការដំណើរការដំណើរការដំណើរការដំណើរការ JavaScript / TypeScript ។
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)
Cài đặt WAF và Bot Management Configure WAF and Bot Management ទាញយក WAF និង Bot Management
Phần «Cấu hình WAF và Bot Management» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Configure WAF and Bot Management" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «ទាញយក WAF និង Bot Management» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
Giải quyết những thách thức đối với lưu lượng bot tiềm năng Issue challenges for potential bot traffic ការធ្វើតេស្តសម្រាប់ការធ្វើតេស្ត botpotential
Phần «Issue challenges for potential bot traffic» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Issue challenges for potential bot traffic" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «ការធ្វើតេស្តសម្រាប់ការធ្វើតេស្ត botpotential» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- Trong bảng điều khiển Cloudflare, đi đến trang WAF.
- In the Cloudflare dashboard, go to the WAF page.
- ក្នុងប្រព័ន្ធប្រតិបត្តិការ Cloudflare សូមចូលទៅក្នុងទំព័រ WAF ។
- Tạo một quy tắc tùy chỉnh mới WAF bằng cách chọn Edit expression:
- Create a new custom WAF rule by selecting Edit expression:
- ការបង្កើតកំណត់ WAF ថ្មីដោយជ្រើស Edit expression:
Cài đặt Cloudflare Turnstile Set up Cloudflare Turnstile ទាញយក Cloudflare Turnstile
Phần «Thiết lập Cloudflare Turnstile» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Set up Cloudflare Turnstile" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «ទាញយក Cloudflare Turnstile» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- Trong bảng điều khiển Cloudflare, đi đến trang Turnstile.
- In the Cloudflare dashboard, go to the Turnstile page.
- ក្នុងប្រព័ន្ធប្រតិបត្តិការ Cloudflare សូមចូលទៅក្នុងទំព័រ Turnstile ។
- Chọn Add widget và điền thông tin cần thiết.
- Thêm tên miền của bạn vào cấu hình Turnstile.
- Chọn Create
- Select Add widget and fill out the necessary information.
- Add your domain to the Turnstile configuration.
- Select Create.
- ចុច Add widget និងបញ្ចូលព័ត៌មានដែលត្រូវការ។
- បន្ថែមអាសយដ្ឋានរបស់អ្នកទៅកំណត់ Turnstile ។
- សូមជ្រើស Create ។
Tích hợp Turnstile vào ứng dụng của bạn Integrate Turnstile into your application ការរួមបញ្ចូល Turnstile ក្នុងកម្មវិធីរបស់អ្នក
Phần «Tích hợp Turnstile into your ứng dụng» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Integrate Turnstile into your application" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «ការរួមបញ្ចូល Turnstile ក្នុងកម្មវិធីរបស់អ្នក» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
Thêm widget Turnstile vào login của bạn form Add the Turnstile widget to your login form Add the Turnstile widget to your login form
Phần «Thêm Turnstile widget vào login form» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Add the Turnstile widget to your login form" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «Add the Turnstile widget to your login form» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
<form id="login-form">
<input type="text" id="username" placeholder="Username" required />
<input type="password" id="password" placeholder="Password" autocomplete="off" required />
<div class="cf-turnstile" data-sitekey="<YOUR-SITE-KEY>"></div>
<button type="submit">Log in</button>
</form>
<script
src="https://challenges.cloudflare.com/turnstile/v0/api.js"
async
defer
></script> <YOUR-SITE-KEY> bằng khóa site Turnstile thực tế của bạn.<YOUR-SITE-KEY> with your actual Turnstile site key.<YOUR-SITE-KEY> ដោយគោលការណ៍ Turnstile របស់អ្នក។Xử lý yêu cầu login Handle the login request ការដោះស្រាយសំណួរ login
Phần «Xử lý login request» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Handle the login request" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «ការដោះស្រាយសំណួរ login» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
async function validateTurnstileToken(
ip: string,
token: string,
secret: string,
): Promise<boolean> {
const response = await fetch(
"https://challenges.cloudflare.com/turnstile/v0/siteverify",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ip, secret, response: token }),
},
);
const outcome = await response.json();
return outcome.success;
}
// Assume that this is a TypeScript route handler.
// You may replace this with a different implementation,
// based on your language or framework
export async function onRequestPost(context) {
const { request, env } = context;
const { username, password, token } = await request.json();
// Validate Turnstile token
const secretKey = env.TURNSTILE_SECRET_KEY;
const ip = request.headers.get("CF-Connecting-IP");
const turnstileValid = await validateTurnstileToken(ip, token, secretKey);
if (!turnstileValid) {
// Return back to the login page with an error message
return Response.redirect("/login", 302, {
headers: {
Location: "/login?error=invalid-turnstile-token",
},
});
}
// Perform your existing authentication logic here
const isValidLogin = await checkCredentials(username, password);
if (isValidLogin) {
return new Response(JSON.stringify({ message: "Login successful" }), {
status: 200,
headers: { "Content-Type": "application/json" },
});
} else {
return new Response(JSON.stringify({ error: "Invalid credentials" }), {
status: 401,
headers: { "Content-Type": "application/json" },
});
}
}
async function checkCredentials(
username: string,
password: string,
): Promise<boolean> {
// Your existing credential checking logic
} Testing Testing Testing
Phần «Testing» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Testing" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «Testing» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- Thêm quy tắc WAF mà luôn luôn chuyển tiếp địa chỉ IP của bạn đến trang thách thức.
- Thêm quy tắc WAF để kiểm tra sự hiện diện của một tham số truy vấn, chẳng hạn như
?challenge=true.
- Add a WAF rule that always forwards your IP address to the challenge page.
- Add a WAF rule that checks for the presence of a query parameter, such as
?challenge=true.
- បន្ថែមប្រព័ន្ធ WAF ដែលធ្វើឱ្យអាសយដ្ឋាន IP របស់អ្នកបានផ្ញើទៅទំព័រជម្រើស។
- បន្ថែមប្រព័ន្ធ WAF ដែលត្រួតពិនិត្យឱ្យមានទំហំសំណួរដូចជា
?challenge=true។
Thực tiễn tốt nhất Best practices ការអនុវត្តល្អបំផុត
Phần «Best practices» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Best practices" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «ការអនុវត្តល្អបំផុត» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- Luôn luôn xác nhận mã thông báo Turnstile ở phía máy chủ trước khi kiểm tra thông tin.
- Sử dụng các biến môi trường để lưu trữ thông tin nhạy cảm như khóa bí mật Turnstile của bạn.
- Thực hiện xử lý lỗi và ghi nhật ký thích hợp để theo dõi các vấn đề bảo mật tiềm tàng.
- Always validate the Turnstile token on the server-side before checking credentials.
- Use environment variables to store sensitive information like your Turnstile secret key.
- Implement proper error handling and logging to monitor for potential security issues.
- សូមប្រាកដ Turnstile នៅលើផ្នែកផ្នែកបណ្តាញមុនពេលត្រួតពិនិត្យឯកសារ។
- ប្រើទំហំបរិស្ថានដើម្បីរក្សាទុកព័ត៌មានសុវត្ថិភាពដូចជា Turnstile secret key របស់អ្នក។
- ការអនុវត្តការដោះស្រាយបញ្ហានិងការកំណត់បញ្ហានិងការត្រួតពិនិត្យបញ្ហានេះដើម្បីត្រួតពិនិត្យបញ្ហានេះសម្រាប់បញ្ហានេះ។
Tài nguyên Resources សមត្ថភាព
Phần «Resources» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Resources" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «សមត្ថភាព» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- Client-side rendering. Learn how to customize how and when Turnstile renders in your user interface, to better fit your application's needs and user experience.
- Server-side validation. Learn how Turnstile's API works, including request parameters, as well as how to handle different types of responses, including error codes.
- Turnstile Analytics. Learn how to view Turnstile's analytics in the Cloudflare dashboard. This includes metrics on the number of challenges issued, as well as the challenge solve rate (CSR).
- Client-side rendering. Learn how to customize how and when Turnstile renders in your user interface, to better fit your application's needs and user experience.
- Server-side validation. Learn how Turnstile's API works, including request parameters, as well as how to handle different types of responses, including error codes.
- Turnstile Analytics. Learn how to view Turnstile's analytics in the Cloudflare dashboard. This includes metrics on the number of challenges issued, as well as the challenge solve rate (CSR).
- Client-side rendering. Learn how to customize how and when Turnstile renders in your user interface, to better fit your application's needs and user experience.
- Server-side validation. Learn how Turnstile's API works, including request parameters, as well as how to handle different types of responses, including error codes.
- Turnstile Analytics. Learn how to view Turnstile's analytics in the Cloudflare dashboard. This includes metrics on the number of challenges issued, as well as the challenge solve rate (CSR).
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/turnstile/","name":"Turnstile"}},{"@type":"ListItem","position":3,"item":{"@id":"/turnstile/tutorials/","name":"Tutorials"}},{"@type":"ListItem","position":4,"item":{"@id":"/turnstile/tutorials/integrating-turnstile-waf-and-bot-management/","name":"Integrate Turnstile, WAF, & Bot Management"}}]} Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)
Xem bản đầy đủ trên developers.cloudflare.com (ảnh, tab cấu hình). View the full guide on developers.cloudflare.com (images, config tabs). មើលមគ្គុទ្ទេសក៍ពេញលើ developers.cloudflare.com (រូបភាព, tab កំណត់)។
Tài liệu gốc ↗ Official docs ↗ ឯកសារផ្លូវការ ↗