GithubActions에서 CloudFlare WAF ByPass하기
작성 일자 : 2025년 02월 16일
발생 오류
GithubActions를 통해 CI/CD 파이프라인을 구축하던 중, CloudFlare WAF로 인해 NextJS 빌드가 실패하는 문제가 발생했습니다.
(필자는 모든 해외 IP를 차단하는 WAF 설정을 사용하고 있습니다.)
#16 667.4 Error: Failed to fetch XXX
#16 667.4 at p (/app/.next/server/app/(main)/page.js:1:29086)
#16 667.4 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
#16 667.4 at async l (/app/.next/server/app/(main)/page.js:1:29875) {
#16 667.4 digest: '3188008111'
#16 667.4 }
해결 방법
xiaotianxt
님께서 제작해주신 bypass-cloudflare-for-github-action
Action을 사용하여 CloudFlare의 IP Access rule을 추가한 후, CloudFlare WAF를 우회하도록 설정하였습니다.
name: Bypass Cloudflare for API Access
on: [push]
jobs:
manage-ip-whitelist:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Bypass Cloudflare for GitHub Action
uses: xiaotianxt/bypass-cloudflare-for-github-action@v1.1.1
with:
cf_zone_id: ${{ secrets.CF_ZONE_ID }}
cf_api_token: ${{ secrets.CF_API_TOKEN }}
- name: Send request to Cloudflare-protected server
run: curl https://example.com/api
Github - bypass-cloudflare-for-github-action
GitHub - xiaotianxt/bypass-cloudflare-for-github-action: Automatically add the public IP of the GitHub Action runner to Cloudfla
Automatically add the public IP of the GitHub Action runner to Cloudflare's firewall IP Access rules. - xiaotianxt/bypass-cloudflare-for-github-action
github.com