ما هو Azure Application Gateway؟
Azure Application Gateway هو موازن تحميل من الطبقة السابعة يوفر التوجيه على مستوى التطبيق وإنهاء SSL وإمكانيات جدار حماية تطبيقات الويب (WAF). يعمل كنقطة دخول رئيسية لحركة مرور الويب التي تتدفق إلى بيئة Azure الخاصة بك، حيث يفحص كل طلب HTTP/HTTPS قبل وصوله إلى تطبيقاتك.
على عكس موازنات التحميل التقليدية التي تعمل على الطبقة الرابعة، يفهم Application Gateway دلالات HTTP ويمكنه اتخاذ قرارات توجيه ذكية بناءً على مسارات URL ورؤوس المضيف وسمات الطلب الأخرى.
الميزات الرئيسية
التوجيه القائم على URL
يمكن لـ Application Gateway توجيه حركة المرور إلى مجموعات خلفية مختلفة بناءً على أنماط URL. على سبيل المثال، يمكن توجيه طلبات /images/* إلى خلفية تخزين صور محسنة بينما تذهب طلبات /api/* إلى خوادم API الخاصة بك.
إنهاء SSL/TLS
يؤدي تفريغ معالجة SSL إلى البوابة إلى تقليل العبء الحسابي على الخوادم الخلفية بنسبة تصل إلى 80%. يدعم SSL من طرف إلى طرف وتفريغ SSL وسياسات SSL مخصصة. يمكن إدارة الشهادات مركزيًا باستخدام تكامل Azure Key Vault.
التحجيم التلقائي
يدعم SKU v2 التحجيم التلقائي بناءً على أنماط حركة المرور، حيث يتم التحجيم من 0 إلى 125 مثيلاً. خلال ساعات الذروة، تضيف البوابة تلقائيًا سعة إضافية. وفي الفترات الهادئة، يتم تقليص الحجم لتحسين التكاليف.
جدار حماية تطبيقات الويب (WAF)
يوفر WAF حماية مركزية ضد الثغرات والاستغلالات الشائعة. مبني على مجموعة قواعد OWASP ModSecurity Core Rule Set (CRS 3.2)، ويدافع ضد حقن SQL والبرمجة عبر المواقع (XSS) وحقن الأوامر وتهريب طلبات HTTP وتهديدات OWASP Top 10 الأخرى.
سياسات WAF والقواعد المخصصة
تسمح سياسات WAF بالتحكم الدقيق في قواعد الأمان. يمكنك إنشاء قواعد مخصصة تطابق نطاقات IP محددة أو الموقع الجغرافي أو رؤوس الطلبات أو محتوى النص. تمنع قواعد تحديد المعدل إساءة الاستخدام عن طريق تقييد الطلبات من مصادر محددة.
وضع الكشف مقابل وضع المنع
في وضع الكشف، يسجل WAF جميع اكتشافات التهديدات دون حظر الطلبات — مثالي للنشر الأولي والضبط. بمجرد الثقة في تكوين القواعد، انتقل إلى وضع المنع حيث يتم حظر الطلبات الضارة بشكل فعال.
أنماط الهندسة المعمارية
متعدد المناطق مع Traffic Manager
للتطبيقات العالمية، قم بنشر Application Gateway في مناطق متعددة خلف Azure Traffic Manager. تمتلك كل منطقة Application Gateway خاصًا بها مع WAF.
وحدة تحكم الدخول AKS (AGIC)
تتكامل وحدة تحكم الدخول Application Gateway أصلاً مع Azure Kubernetes Service. تراقب وحدة التحكم موارد الدخول في Kubernetes وتقوم تلقائيًا بتكوين Application Gateway.
تحسين الأداء
يضمن تصريف الاتصال الإزالة السلسة لمثيلات الخلفية أثناء عمليات النشر. يدعم HTTP/2 تقليل زمن الوصول من خلال تعدد الإرسال. تحافظ تقارب الجلسة المستند إلى ملفات تعريف الارتباط على جلسات المستخدم على نفس خادم الخلفية.
أفضل الممارسات
- استخدم دائمًا SKU v2 للتحجيم التلقائي ودعم تكرار المنطقة
- قم بتمكين تسجيل التشخيص وأرسل السجلات إلى Log Analytics
- استخدم القواعد المُدارة كخط أساس وأضف استثناءات مخصصة للإيجابيات الخاطئة
- قم بدمج Azure Key Vault لإدارة الشهادات التلقائية
- انشر عبر مناطق التوفر لاتفاقية مستوى خدمة بنسبة 99.99%
الميزات والقدرات الرئيسية
تجعل القدرات الأساسية التالية هذه التقنية ضرورية للبنية التحتية السحابية الحديثة:
Layer 7 Load Balancing
URL path-based and host-based routing distributing traffic across backend pools with cookie-based session affinity and connection draining
Web Application Firewall
OWASP CRS 3.2 rule set blocking SQL injection, XSS, and command injection with per-rule customization and exclusion lists
SSL/TLS Termination
Centralized certificate management with Key Vault integration, end-to-end TLS re-encryption, and support for TLS 1.3 cipher suites
Autoscaling
V2 SKU automatically scales from 0 to 125 instances based on traffic patterns, eliminating capacity planning and reducing costs during low traffic
Private Link Integration
Backend connectivity through Private Endpoints, enabling Application Gateway to reach services in other VNets or even on-premises through ExpressRoute
حالات الاستخدام الواقعية
تستفيد المؤسسات عبر القطاعات المختلفة من هذه التقنية في بيئات الإنتاج:
Multi-Tenant SaaS
Host-based routing directs tenant1.app.com and tenant2.app.com to isolated backend pools while sharing a single Gateway instance
API Gateway Complement
Application Gateway handles TLS termination and WAF protection in front of Azure API Management, adding network-level security to API-level policies
Blue-Green Deployment
Backend pool weights enable gradual traffic shifting from blue to green environments with instant rollback capability
Compliance Gateway
WAF blocks common OWASP Top 10 attacks while custom rules enforce geographic restrictions and request body size limits for regulated workloads
أفضل الممارسات والتوصيات
استنادًا إلى عمليات النشر المؤسسية والخبرة الإنتاجية تساعد هذه التوصيات في تحقيق أقصى قيمة:
- Use WAF_v2 SKU with autoscaling in production — V1 SKU lacks critical features and is on deprecation path
- Start WAF in Detection mode for 2 weeks to build rule exclusions before switching to Prevention mode
- Integrate health probes with application-level checks (/health endpoint returning HTTP 200) rather than TCP-only checks
- Enable access logs and WAF logs to Log Analytics — correlate blocked requests with legitimate traffic for false positive tuning
- Use Key Vault references for SSL certificates with managed identity — avoid manual certificate deployment and renewal
- Configure connection draining timeout (30-60 seconds) to prevent request failures during backend deployments
الأسئلة الشائعة
What is the difference between Application Gateway and Azure Front Door?
Application Gateway is regional, deployed in your VNet for private backend connectivity. Front Door is global edge with anycast routing, built-in CDN, and DDoS protection. Use Application Gateway for regional apps with VNet requirements, Front Door for global multi-region applications.
How much does WAF cost?
WAF_v2 starts at ~$0.36/hour (~$260/month) base plus ~$0.008/capacity unit. A typical deployment processing 100 requests/second costs approximately $350-$500/month. The cost is significantly lower than third-party WAF appliances requiring dedicated VM infrastructure.
Can WAF protect against zero-day attacks?
WAF with Bot Protection and DRS 2.1 rule set includes behavioral-based detection that catches many zero-day patterns. For advanced protection, enable Microsoft Threat Intelligence feed and integrate with Microsoft Sentinel for custom detection rules.



