星期四, 19 6 月, 2025
No Result
View All Result
育心文具行

育心文具行

  • 首頁
  • 心得x體驗
  • 筆記x備忘
  • 閒談x雜記
  • 我的工具箱
  • 關於我
育心文具行
  • 首頁
  • 心得x體驗
  • 筆記x備忘
  • 閒談x雜記
  • 我的工具箱
  • 關於我
No Result
View All Result
育心文具行
Home 筆記x備忘

Cloudflare 封鎖網路爬蟲

2023-10-05
in 筆記x備忘
Reading Time:2 mins read
A A
0
steampunk spider, biomechanical, 3 d model, unreal engine realistic render, 8 k, micro detail, intricate, elegant, highly detailed, centered, digital painting, artstation, smooth, sharp focus, illustration, artgerm, tomasz alen kopera, by wlop

如果你不想要某些網域被網路爬蟲抓到,但是不想更改網站上應用程式的話,除了從 nginx 限制 IP 或是 base-auth 之外,也可以從 cloudfalre 下手。當然前提是你的網域必需要經過 cloudlfare 的邊際網絡。

這裡介紹可以使用 Cloudfalre 的 WAF 功能。

進入 WAF 頁面後,點擊建立規則。

點擊,編輯運算式,輸入以的 user agent 條件。

(cf.client.bot) 
or (http.user_agent contains "Googlebot")
or (http.user_agent contains "Bingbot")
or (http.user_agent contains "bing")
or (http.user_agent contains "Slurp")
or (http.user_agent contains "DuckDuckBot")
or (http.user_agent contains "Baiduspider")
or (http.user_agent contains "YandexBot")
or (http.user_agent contains "sogou")
or (http.user_agent contains "Spider")
or (http.user_agent contains "Exabot")
or (http.user_agent contains "facebot")
or (http.user_agent contains "PetalBot")
or (http.user_agent contains "SEMrushBot")
or (http.user_agent contains "Majestic")
or (http.user_agent contains "DotBot")
or (http.user_agent contains "AhrefsBot")

這條件應該還可以再添加,但是規則有總字符數上限。上面列出的是常見的爬蟲包含名稱。同樣的,如果你想要封鎖你不想要的爬蟲名稱也可以再上面設定,不過 Cloudflare 其實有一個「機器人對抗模式」的功能,啟用後他會封鎖壞機器人。 WAF 免費只能有 5 個規則,使用上還是得注意一下喔!

再來規則就選擇封鎖,然後部署。

再來用 postman 更改 useragent 測試看看,確認沒問題就行啦!以上。

Tags: cloudfalreuseragent封鎖網路爬蟲
Share22Tweet14
Previous Post

《也許你該找人聊聊 》第二部讀書心得

Next Post

《灰階思考》第一部讀書心得

Related Posts

No Content Available
Load More
Next Post
tom holland rings the opening bell at the new york stock exchange trading floor, 3 5 mm photography, highly detailed, cinematic lighting, 4 k

《灰階思考》第一部讀書心得

sailing ship emerging from ocean

《灰階思考》第二部讀書心得

前端 web worker 筆記

全站搜尋

No Result
View All Result

關於我

育心文具行

Jerry Lin

程式設計師

育心文具行是一家文具店,老闆的小兒子是一個設計師,職業是設計程式,興趣是設計人,倒是還沒有實作的機會。
--
所有的相遇都不是巧合。
在廣告公司待了三年有兩年多在做內容產品,離職後繼續在內容產業走了四年多,最後選則離開台灣的公司體制在家 SOHO ,碰上了 2020 年疫情才知道原來自己這是走在時代的潮流尖端。 感謝許多老闆和貴人相助,至今目前尚能存活,在台北街頭努力著。

近期文章

  • 於 MacOS 中,整合自然語言,自動化添加行事曆事件
  • 使用 deepwiki-open 針對程式碼產生 WIKI
  • 使用 Tailwind CLI 快速建立靜態 CSS 檔的基本步驟
  • Visual Studio Code 的 PHP CS Fixer 設定
  • MacOS 添加本地伺服器的 DNS

分類

  • 心得x體驗 (45)
  • 筆記x備忘 (77)
  • 閒談x雜記 (13)

贊助買咖啡

Facebook Instagram RSS

標籤

ai android cloudflare flutter git ios javascript linode linux MAC macos mis nginx php plugin QBQ!問題背後的問題 server work sublime sublime text vps vue.js vue3 What if What If? 如果這樣,會怎樣? wordpress 前端 原則 原子習慣 團隊,從傳球開始 團隊,從傳球開始:五百年都難以超越的 UCLA 傳奇教練伍登培養優越人才和團隊的領導心法 壓力測試 外掛 如果這樣,會怎樣?:胡思亂想的搞怪趣問 正經認真的科學妙答 心得 情緒 活動心得 灰階思考 約翰‧漢尼斯 股癌 自慢10 自慢10:18項修練 記錄 謝孟恭 讀書心得 這一生,你想留下什麼?

文章分類

  • 心得x體驗 (45)
  • 筆記x備忘 (77)
  • 閒談x雜記 (13)

近期文章

  • 於 MacOS 中,整合自然語言,自動化添加行事曆事件
  • 使用 deepwiki-open 針對程式碼產生 WIKI
  • 使用 Tailwind CLI 快速建立靜態 CSS 檔的基本步驟
  • Visual Studio Code 的 PHP CS Fixer 設定
  • MacOS 添加本地伺服器的 DNS

近期留言

  • 「Bolin Lai」於〈WordPress 之中藍新金流開啟後, Elementor 外掛有時會打不開的問題處理〉發佈留言
  • 「Jerry Lin」於〈WordPress 之中藍新金流開啟後, Elementor 外掛有時會打不開的問題處理〉發佈留言
  • 「JCL」於〈WordPress 之中藍新金流開啟後, Elementor 外掛有時會打不開的問題處理〉發佈留言

文章月曆

2025 年 6 月
日 一 二 三 四 五 六
1234567
891011121314
15161718192021
22232425262728
2930  
« 5 月    

© 2020 hipster.crazyjerry.studio - a blog about experience, notes and nonsense, by Jerry Lin.

No Result
View All Result
  • 首頁
  • 心得x體驗
  • 筆記x備忘
  • 閒談x雜記
  • 我的工具箱
  • 關於我

© 2020 hipster.crazyjerry.studio - a blog about experience, notes and nonsense, by Jerry Lin.