cloudflare-logo

Cloudflare 防火牆規則說明

Cloudflare防火牆規則使用方法

各分案比較

方案 規則數量 攔截方式 是否允許正則
Free/PRO-plus 5 No Log No
PRO 20 No Log No
Business 100 No Log Yes
Enterprise 1000 All Yes

部分案例

案例 說明
(ip.src ne 127.0.0.1) 全站開啟驗證碼,訪客IP不是127.0.0.1開啟防禦機制
(not cf.client.bot) 非搜尋引擎的IP進行的訪問進行驗證碼或遮蔽
(not ip.geoip.country in {“CN" “HK" “TW" “MO"} and not cf.client.bot) 訪客不是大陸,香港,台灣,澳門的並且不是搜尋引擎的進行攔截(加入搜尋引擎判斷,防止Google,BING等國外搜尋引擎被攔截)
(not ip.geoip.country in {“CN" “HK" “TW" “MO"} and http.request.full_uri contains “login") 訪客不是大陸,香港,台灣,澳門的並且訪問的連結裡面帶有login的就進行防火牆動作
(ip.geoip.country in {“CN"} and http.request.full_uri contains “login") or (ip.geoip.country in {“CN"} and http.request.full_uri contains “register") 大陸訪客的並且訪問的連結裡面帶有login/或者register的就進行防火牆動作
(not http.referer contains “bnxb.com" and not http.referer contains “baidu.com") or (http.referer eq “") 防盜鏈:來路域名非bnxb.com(含子域名)也非百度下的域名,或者來路為空就觸發防火牆攔截
(http.request.full_uri contains “cdn.bnxb.com" and not ip.geoip.country in {“CN" “HK"}) cdn.bnxb.com這個子域名只允許大陸,香港訪問,其他遮蔽
規則類型及編寫方法
判斷語句 eq-等於,ne-不等於,gt-大於,lt-小於,ge-大於等於,le-小於等於,contains-包含,not contains-不包含,in-在某幾個裡面,not in-不在裡面
多個條件組合可以用and並且,or或者來連接,例如:
(http.request.full_uri contains “?" and http.request.full_uri contains “cate=" and not http.request.full_uri contains “js")
意思是訪問的URL裡面包含?並且包含cate= 並且不包含js的進行處理
規則名稱 允許類型 說明/範例
http.cookie

字串

eq\ne\contains\not contains\matches\not matches 判斷本地COOKIE是否包含某些特定值支援matches\not matches匹配正則

注意兩端需要用括號括起來,可以用and ,or 連接,類似

(not http.cookie contains “session=8521F670545D7865F79C3D7BED C29CCE;-background=light" and ip.geoip.asnum lt 2000)

(http.cookie eq “session=8521F670545D7865F79C3D7BED C29CCE;-background=light")

(http.cookie ne “session=8521F670545D7865F79C3D7BED C29CCE;-background=light")

(http.cookie contains “session=8521F670545D7865F79C3D7BED C29CCE;-background=light")

(not http.cookie contains “session=8521F670545D7865F79C3D7BED C29CCE;-background=light")

http.host

字串

eq\ne\contains\not contains\in\not in\matches\not matches 主機名,判斷主機名是否存在設定的值支援正則匹配matches\not matches

(http.host eq “bnxb.com")

(http.host ne “bnxb.com")

(http.host contains “bnxb.com")

(not http.host contains “bnxb.com")

(http.host in {“bnxb.com" “cdn.bnxb.com"})

(not http.host in {“bnxb.com" “cdn.bnxb.com"})

http.referer

字串

eq\ne\contains\not contains\matches\not matches 判斷來源是否存在設定的值,正常用cotains(包含)和not contains(不包含)支援正則匹配matches\not matches

(http.referer contains “bnxb.com")

(not http.referer contains “bnxb.com")

http.request.full_uri

字串

eq\ne\contains\not contains\matches\not matches 設定防火牆的網站的某個完整連結,訪客訪問這個連結就會觸發防禦規則,不能含#,正常可以用contains 來判斷域名中含有某個詞的進行攔截或者放行,支援正則匹配matches\not matches

(http.request.full_uri eq “https://www.bnxb.com/html/123.html")

(http.request.full_uri ne “https://www.bnxb.com/html/123.html")

(http.request.full_uri contains “123″)

(not http.request.full_uri contains “123″)

http.request.method

字串

eq\ne\in\not in 訪客請求您網站的方式,可選GET,POST,PURGE,PUT,HEAD,OPTIONS,DELETE,PATCH

(http.request.method eq “GET")

(http.request.method ne “GET")

(http.request.method in {“GET" “POST" “PUT"})

(not http.request.method in {“GET" “POST" “PUT"})

http.request.uri

字串

eq\ne\contains\not contains\matches\not matches 您域名的URI

(http.request.uri eq “/articles/index?section=539061&expand=comments")

(http.request.uri ne “/articles/index?section=539061&expand=comments")

(http.request.uri contains “expand=comments")

(not http.request.uri contains “expand=comments")

http.request.uri.path

字串

eq\ne\contains\not contains\in\not in\matches\not matches 請求路徑

(http.request.uri.path eq “/articles/index")

(http.request.uri.path ne “/articles/index")

(http.request.uri.path contains “/articles/index")

(not http.request.uri.path contains “/articles/index")

(http.request.uri.path in {“/articles/index" “/articles/bnxb" “/bnxb/com"})

(not http.request.uri.path in {“/articles/index" “/articles/bnxb" “/bnxb/com"})

http.request.uri.query

字串

eq\ne\contains\not contains\matches\not matches query請求參數,也就是?後面的一串

(http.request.uri.query eq “section=539061&expand=comments")

(http.request.uri.query ne “section=539061&expand=comments")

(http.request.uri.query contains “expand=comments")

(not http.request.uri.query contains “expand=comments")

http.request.version

字串

eq\ne\contains\not contains HTTP請求協議的版本,有以下選項

HTTP/1.0

HTTP/1.1

HTTP/1.2

HTTP/2

HTTP/3

SPDY/3.1

(http.request.version eq “SPDY/3.1″)

(http.request.version ne “SPDY/3.1″)

(http.request.version in {“SPDY/3.1″ “HTTP/1.1″ “HTTP/2″})

(not http.request.version in {“SPDY/3.1″ “HTTP/1.1″ “HTTP/2″})

http.user_agent

字串

eq\ne\contains\not contain\matches\not matches 使用者瀏覽器標識,推薦使用contains/not contains

(http.user_agent eq “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36″)

(http.user_agent ne “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36″)

(http.user_agent contains “Chrome/65.0.3325.181″)

(not http.user_agent contains “Chrome/65.0.3325.181″)

http.x_forwarded_for

字串

eq\ne\contains\not contain\matches\not matches x-forwarded-for標頭 支援matches\not matches匹配正規表示式

(http.x_forwarded_for eq “111.111.11.11″)

(http.x_forwarded_for ne “111.111.11.11″)

(http.x_forwarded_for contains “11.11″)

(not http.x_forwarded_for contains “11.11″)

ip.src

IP位址

eq\ne\in\not in 客戶端IP地址

(ip.src eq 192.0.2.0)

(ip.src ne 192.0.2.0)

(ip.src in {192.0.2.0 192.0.3.0 192.168.1.1})

(not ip.src in {192.0.2.0 192.0.3.0 192.168.1.1})

ip.geoip.asnum

數字

eq\ne\gt\lt\ge\le\in\not in 訪客IP所屬的AS號,gt-大於,lt-小於,ge-大於等於,le-小於等於

(ip.geoip.asnum eq 13335)

(ip.geoip.asnum ne 13335)

(ip.geoip.asnum gt 13335)

(ip.geoip.asnum lt 13335)

(ip.geoip.asnum ge 13335)

(ip.geoip.asnum le 13335)

(ip.geoip.asnum in {13335 13332 11112})

(not ip.geoip.asnum in {13335 13332 11112})

ip.geoip.continent

字串

eq\ne\in\not in 訪客所屬的洲(7大洲),洲程式碼如下:

  • AF – 非洲
  • AN – 南極洲
  • AS – 亞洲
  • EU – 歐洲
  • NA – 北美洲
  • OC – 大洋洲
  • SA – 南美洲

( 或者 T1 代表 Tor網路)

(ip.geoip.continent eq “AS")

(ip.geoip.continent ne “AS")

(ip.geoip.continent in {“AS" “AF" “EU" “OC"})

(not ip.geoip.continent in {“AS" “AF" “EU" “OC"})

ip.geoip.country

字串

eq\ne\in\not in 訪客所屬國家,使用二位英文字母標識國別,詳見http://tool.bnxb.com/domainname.html

(ip.geoip.country eq “CN")

(ip.geoip.country ne “CN")

(ip.geoip.country in {“CN" “HK" “TW" “MO"})

(not ip.geoip.country in {“CN" “HK" “TW" “MO"})

ip.geoip.subdivision_1_iso_code

字串

If known, the ISO 3166-2 code for the first level region associated with the IP address. 1 If not known, this is an empty string.

GB-ENG

ip.geoip.subdivision_2_iso_code

字串

If known, the ISO 3166-2 code for the second level region associated with the IP address. If not known, this is an empty string.

GB-SWK

ip.geoip.is_in_european_union

布林

True if this is an EU country

true

Ssl

布林

是否使用HTTPS
cf.client.bot

布林

基於各家搜尋引擎IP段判斷是否放行(支援Google,yahoo,yandex,apple,archive,bing,feedbin,grapeshot,linkedin,mail.ru,naver,pingdom,pinterest,seznam,uptimerobot)

(cf.client.bot)

(not cf.client.bot)

cf.threat_score

數字

eq\ne\gt\lt\ge\le\in\not in 訪客IP的威脅評分等級,越大說明CF對這個IP視為越危險,10分以上均屬於較不安全的IP,40分以上屬於對網際網路有過攻擊行為的IP,因此可以設定10分以上顯示驗證碼,50分以上攔截。(這個設定與防禦等級設定是使用同一套評分系統,防禦等級-分值>0,防禦等級-分值>14,防禦等級-分值>24,防禦等級半關閉-分值>49)

(cf.threat_score eq 2)

(cf.threat_score ne 2)

(cf.threat_score gt 2)

(cf.threat_score lt 2)

(cf.threat_score ge 2)

(cf.threat_score le 2)

(cf.threat_score in {2 5 8})

(not cf.threat_score in {2 5 8})

cf.tls_client_auth.cert_verified

布林

已驗證客戶端證書

(cf.tls_client_auth.cert_verified)

(not cf.tls_client_auth.cert_verified)

bg1

ECSHOP近期客戶開發功能一覽表

國泰銀行信用卡刷卡付款

玉山銀行信用卡刷卡付款

綠界信用卡刷卡功能修正(可讓客戶付款失敗再支付,折扣進位修正避免付款狀態變更失敗)

不同物流金流搭配享受不同折扣

登入手機安全驗證

客戶訂單留言顯示優化

黑名單控制功能

自動贈送購物金功能

發票資訊記憶儲存(未來會員回購時可點選直接帶入)

訂單列印增加條碼功能(商品條碼以及訂單條碼)

ecshop開發 功能客製化

ECSHOP客製化開發服務

本公司提供ECHSOP各種客製化功能服務,如果您有任何功能開發需求都歡迎來電或來信訊問我們。
我們開發ECSHOP服務已經有8年以上經驗,開發過數百項客戶需求功能,涵蓋範圍如下:

  • ECSHOP原始功能強化
  • ECSHOP原始功能修正
  • ECSHOP網站功能延伸開發
  • 各種金流API串接(各家銀行、第三方支付、LINE…等等)
  • 第三方API串接(FB登入/LINE登入/ERP系統串接)
  • ECSHOP搜尋引擎優化(SEO工程)
  • ECSHOP結帳流程優化
  • ECSHOP後台管理優化
  • ECSHOP前台版型美化

如果您常常遇到電商網站功能沒辦法滿足您的需求,想請人開發卻求助無門,安全遇到問題沒人能協助解決,網站沒辦法貼近您的公司操作流程,有問題卻常被其他廠商踢皮球導致無法解決 ! 如果有上述狀況歡迎來找我們,我們公司將提供您全新的ECSHOP電子商務服務感受,成為您最強的技術後盾。

本公司亦歡迎同業進行發包

ecshop開發 功能客製化
ECSHOP專案開發

最強大的ECSHOP響應式模板(RWD-SHOP 2023年全新改版)

【2023年響應式ECSHOP改版更新內容】

最強大的ECSHOP技術支援就在這裡,幫您從網站安全、網站美觀、網站使用者體驗、網站SEO優化全方位顧及,自己架設電商網站讓您沒煩惱 !

本公司也提供ECSHOP功能客製化服務,如有任何開發需求都歡迎來信/來電洽詢 :)

  • PHP7.3版本支援
  • 多重防火牆功能 (可有效阻擋SQL注入/XSS攻擊)
  • ECSHOP網址SEO優化 (可在網址列上顯示商品名稱/商品分類名稱)
  • 搜尋頁優化功能
  • 網站黑名單功能 (選購)
  • 手機驗證註冊/登入功能 (選購)

 

【2022年響應式ECSHOP方案】

  • 響應式RWD-ECSHOP 前台版型 / 後台版面升級
  • ECSHOP 獨家安全升級版 ( 已知漏洞修正 / 後台安全登入通知)
  • 超商取貨全套功能 ( 前台電子地圖串接 / 後台超商訂單獨立管理)
  • 金流 ( 信用卡/ 信用卡分期/ 超商繳費/ ATM轉帳 )
  • FACEBOOK第三方登入功能
  • 可協助代購網域 + 虛擬主機 “免任何設定安裝費用"
    閱讀更多