Teksolvr
技術参照ハブに戻る

Cloudflare Secure Rules Configuration

安全なWebサーバー設定・構成コード参照ガイド

Webサーバー / CDN

Cloudflare Secure Rules Configuration

標準設定ファイル種別

Cloudflare Page & Transform Rules

セキュリティ監査の適用範囲

Cloudflareエッジでのセキュリティ設定の最適化。HTTPSへの強制転送を行うPage Rulesや、プロキシレイヤーでのレスポンスヘッダー追加。

Webサーバー堅牢化の基本原則

Webサーバー層(Nginx, Apache)やエッジCDN(Cloudflare)での適切なセキュリティ設定の適用は、通信の盗聴や改ざん、情報漏洩を防ぐための最も重要かつ基本的な対策です。正しいリダイレクトの設定により平文通信を排除し、セキュリティヘッダーの付与により各種インジェクション攻撃を防止します。

設定コードの適用手順

Always Use HTTPS Rule configuration

Configure Cloudflare Page Rule to force SSL traffic.

If URL matches: http://*example.com/*
Then setting is: Always Use HTTPS

Edge Cache Control and HTTP HSTS settings

Configure security headers directly via Cloudflare Ruleset Engine without server overhead.

# HTTP Response Header Modification Rules
If incoming request matches: all incoming requests
Then modify header: add Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"