Files
llm-wiki/raw/official-docs/cloudflare-tunnel-routing-official.md

9.7 KiB

title, source_type, url, archive_url, status, confidence, tags, related_projects, related_branches, created, last_reviewed
title source_type url archive_url status confidence tags related_projects related_branches created last_reviewed
Cloudflare Tunnel — DNS routing & outbound-only connection (official) official-doc https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/ raw high
keycloak-patterns
p3b-single-ec2-google
cloudflare-tunnel
cloudflared
public-uri
local-dev
oauth-callback
keycloak-patterns
feature-keycloak-patterns
feature-keycloak-single-ec2-google-federation
2026-05-25 2026-05-27

Cloudflare Tunnel — Routing (공식)

Layer: raw/official-docs/ — Cloudflare 공식 문서의 원문 발췌·출처 기록. 단일 EC2 + Google federation에서 EC2 inbound port를 열지 않고도 public HTTPS hostname을 노출하는 방법. ngrok 대안. 검증된 요약은 /ingestwiki/concepts/에 별도 작성.

Parent / 활용 branch (필수)

이 자료는 혼자 존재하지 않는다. 어느 branch 의 어떤 결정의 근거인지 명시.

Branch 이 자료가 정당화하는 결정
raw/branch-notes/feature-keycloak-patterns P3B (Single EC2 + Google federation) 변형에서 public HTTPS 노출 수단으로 Cloudflare Tunnel 후보 검토 근거
raw/branch-notes/feature-keycloak-single-ec2-google-federation EC2 inbound port 0 + 고정 hostname 요구 충족 수단으로 cloudflared 채택 근거

컨텍스트

P3B 단일 EC2에서 Google이 도달할 수 있는 public URL이 필요하지만, EC2 보안 그룹을 80/443 외부 개방하는 것은 학습 환경에서 부담스러울 수 있다. Cloudflare Tunnel(cloudflared)은 EC2 → Cloudflare로 outbound 연결만 사용 → inbound port 0개로 public hostname 노출 가능.

출처 / Source

핵심 인용 / Key quotes (verbatim)

[§Outbound-only connections] "cloudflared initiates an outbound connection through your firewall from the origin to the Cloudflare global network."

[§Outbound-only connections] "You can then configure your firewall to allow only these outbound connections and block all inbound traffic"

[§DNS records and tunnel subdomains (routing-to-tunnel/dns/)] "When you create a tunnel, Cloudflare generates a subdomain at <UUID>.cfargotunnel.com."

[§DNS records and tunnel subdomains (routing-to-tunnel/dns/)] "You point a CNAME record at this subdomain to route traffic from your hostname to the tunnel."

needs-confirmation: 2026-05-25 작성 당시 인용된 "Published applications inherit the Cloudflare settings for their hostname, including cache rules, WAF rules, and other Rules configurations." 문장은 2026-05-27 재확인 시점에 메인/관련 sub-page 에서 발견되지 않음. 페이지 개정 또는 원본이 paraphrase였을 가능성. Cloudflare edge 가 zone 단위로 WAF/캐시 정책을 적용한다는 일반적 동작은 사실이지만, 본 자료의 verbatim 근거로는 불가 — 별도 인용 필요.

Claims Extracted / 추출된 주장

자료가 직접 말하는 것만 claim 으로 분리. 내 프로젝트에 적용한 결론은 여기 쓰지 않음.

Claim ID Claim (이 자료가 직접 말하는 것) Evidence quote Strength Applies to Does not prove
CLOUDFLARE-TUNNEL-C1 cloudflared 는 origin → Cloudflare global network 으로 outbound 연결을 개시한다 (inbound 불필요) [§Outbound-only connections] "cloudflared initiates an outbound connection through your firewall from the origin to the Cloudflare global network." official-vendor-doc cloudflared 를 origin (예: EC2) 에서 실행하는 모든 시나리오 방화벽이 outbound 443 을 차단한 환경에서도 동작한다는 뜻은 아님. 또한 NAT/proxy 통과 보장은 별도 검증 필요
CLOUDFLARE-TUNNEL-C2 방화벽을 outbound 만 허용하고 inbound 를 전부 차단하는 구성이 공식 권장 [§Outbound-only connections] "You can then configure your firewall to allow only these outbound connections and block all inbound traffic" official-vendor-doc inbound port 노출을 피하려는 self-host / on-prem / EC2 모든 use case 에서 inbound 차단이 충분하다는 뜻은 아님 — Tunnel 외 다른 서비스 (예: SSH 관리 채널) 는 별도 정책
CLOUDFLARE-TUNNEL-C3 터널 생성 시 Cloudflare 는 <UUID>.cfargotunnel.com 형태의 subdomain 을 자동 부여 [§DNS records and tunnel subdomains] "When you create a tunnel, Cloudflare generates a subdomain at <UUID>.cfargotunnel.com." official-vendor-doc Cloudflare Tunnel 의 모든 tunnel UUID 의 안정성 (재생성 시 동일성) 은 별도 항목, 본 인용으로 보장 안 됨
CLOUDFLARE-TUNNEL-C4 사용자 도메인 hostname 에서 <UUID>.cfargotunnel.com 으로 CNAME 을 설정하면 트래픽이 터널로 라우팅됨 [§DNS records and tunnel subdomains] "You point a CNAME record at this subdomain to route traffic from your hostname to the tunnel." official-vendor-doc Cloudflare 가 관리하는 zone 의 hostname 다른 DNS provider 가 관리하는 zone 에서도 동일 동작한다는 뜻은 아님 ("cfargotunnel.com subdomain only proxies traffic for DNS records in the same Cloudflare account" 단서)
CLOUDFLARE-TUNNEL-C5 cloudflared tunnel route dns <UUID-or-NAME> <hostname> 명령으로 locally-managed tunnel 의 DNS 라우팅을 자동 생성 가능 [§DNS routing command] "cloudflared tunnel route dns <UUID or NAME> www.app.com" + "creates a CNAME record but does not proxy traffic unless the tunnel is running." official-vendor-doc locally-managed tunnel (config.yml 또는 CLI) tunnel 이 running 상태가 아니면 트래픽이 흐르지 않음을 명시 — 라우팅 성공 ≠ tunnel 가용
CLOUDFLARE-TUNNEL-C6 OAuth callback URL 등 특정 use case 에 Cloudflare Tunnel 이 공식 권장이라는 직접 언급은 인용 범위 내에 없음 (인용 없음 — 부재 사실 자체가 claim) needs-confirmation Keycloak Google federation 의 redirect_uri 호스팅 시나리오 Cloudflare Tunnel 이 OAuth callback 에 부적합하다는 뜻도 아님. 단지 공식 문서가 직접 보증하지 않는다는 사실

Usage Boundaries / 적용 경계

  • 이 자료가 직접 증명하는 것:
    • CLOUDFLARE-TUNNEL-C1, C2: cloudflared 가 outbound-only 모델로 동작하며 공식적으로 inbound 차단 구성을 권장
    • CLOUDFLARE-TUNNEL-C3, C4, C5: tunnel UUID 기반 cfargotunnel.com subdomain + CNAME / cloudflared tunnel route dns 명령의 동작 메커니즘
  • 이 자료가 증명하지 않는 것:
    • Keycloak /realms/<r>/broker/google/endpoint 같은 OAuth callback 경로가 Cloudflare Tunnel 환경에서 무수정 동작한다는 보장 (TLS 종단·proxy header 처리는 Keycloak KC_PROXY_HEADERS / KC_HOSTNAME 측 결정과 결합되어야 함)
    • Cloudflare edge 의 WAF / 캐시 / Rules 가 tunnel-exposed 앱에 자동 적용된다는 점 (2026-05-25 인용은 verbatim 재확인 실패, C6 참조)
    • 무료 plan 의 동시 connection 수 / bandwidth limit (정책 변경 잦음, 별도 가격 페이지 확인 필요)
  • 내 프로젝트에 적용하려면 추가 확인이 필요한 것:
    • Keycloak 가 X-Forwarded-Proto: https 를 cloudflared 의 origin request 에서 정확히 받는지 (Cloudflare → origin tunnel 구간의 header 동작) — local 검증 필수
    • Google Cloud Console 의 redirect URI 정책이 cfargotunnel.com 도메인을 그대로 허용하는지 (등록 도메인 verification 요구사항)

P3B 함의 (내 프로젝트 해석)

본 섹션은 자료의 직접 인용이 아니라 P3B 결정 컨텍스트에서의 해석. wiki 추출 시 wiki/concepts/ 또는 wiki/projects/ 의 source-summary 로 옮겨야 함.

  • Cloudflare 계정 + 무료 plan + Cloudflare에 등록된 도메인 1개 필요.
  • EC2에 cloudflared 데몬 → cloudflared tunnel run <tunnel-name>kc.example.com CNAME → <UUID>.cfargotunnel.com → Keycloak :8080.
  • TLS는 Cloudflare edge가 종단 → EC2 내부는 HTTP로 backend 통신 가능. Keycloak KC_HTTP_ENABLED=true + KC_PROXY_HEADERS=xforwarded.
  • Google Cloud Console redirect URI: https://kc.example.com/realms/dev/broker/google/endpoint 그대로 사용 가능 (고정 hostname).
  • ngrok 대비 장점: hostname 고정 + 무료 + EC2 inbound port 0.
  • 단점: Cloudflare에 등록된 도메인 1개 + DNS 설정 1회 필요 (학습 진입 비용은 ngrok보다 약간 큼).

메모 / Notes

  • 2026-05-27 재검증: ## 핵심 인용 의 cfargotunnel.com 인용은 메인 페이지가 아니라 routing-to-tunnel/dns/ sub-page 에서 발견. 향후 인용 시 sub-URL 명시.
  • 인용 시점에 있던 "Published applications inherit the Cloudflare settings…" 문장은 현재 부재 — 페이지 개정 또는 원본 paraphrase 가능성. wiki/concepts/ 승급 시 본 항목을 근거로 사용 금지.