- Home
- CDN Simulator
- Verify
Verify
After deployment, run these checks to confirm the CDN edge node is functioning correctly. Allow 2-3 minutes after terraform apply for cloud-init to finish installing NGINX.
Health Check
Section titled “Health Check”Verify NGINX is running and responding:
curl -s "http://<PUBLIC_IP>/health" | jq .Expected output:
{ "status": "healthy", "component": "cdn-edge", "engine": "nginx", "vendor_profiles": [ "akamai", "cloudflare", "cloudfront", "fastly", "azure-front-door" ]}If using Terraform outputs:
curl -s "$(terraform output -raw health_check_url)" | jq .Cache Miss (First Request)
Section titled “Cache Miss (First Request)”The first request to any path will be a cache miss — the edge fetches from origin:
curl -I "http://<PUBLIC_IP>/"Look for these headers in the response:
X-Cache-Status: MISSX-CDN-Edge: cdn-simulatorMISS means the content was not in cache and was fetched from the origin server.
Cache Hit (Subsequent Request)
Section titled “Cache Hit (Subsequent Request)”Repeat the same request immediately:
curl -I "http://<PUBLIC_IP>/"Expected headers:
X-Cache-Status: HITX-CDN-Edge: cdn-simulatorHIT confirms the response was served from the NGINX disk cache without contacting the origin.
Cache Directory Inspection
Section titled “Cache Directory Inspection”SSH into the VM to verify cached content exists on disk:
ssh azureuser@<PUBLIC_IP>
# Check cache directory has contentsudo find /var/cache/nginx/cdn -type f | head -20
# Check cache sizesudo du -sh /var/cache/nginx/cdnNGINX Status
Section titled “NGINX Status”Verify NGINX is running and the configuration is valid:
ssh azureuser@<PUBLIC_IP>
# Check service statussudo systemctl status nginx
# Validate configurationsudo nginx -t
# View active connections (if stub_status is enabled)curl -s http://localhost/healthOrigin Connectivity
Section titled “Origin Connectivity”Verify the edge node can reach the origin server:
ssh azureuser@<PUBLIC_IP>
# Test connectivity to origin (replace with your origin URL)curl -I "https://your-origin.example.com/"If this fails, check:
- The
origin_servervariable is correct in the Terraform config - The origin server allows inbound connections from the edge node’s public IP
- DNS resolution works from the VM (
nslookup your-origin.example.com)
Cloud-Init Progress
Section titled “Cloud-Init Progress”Monitor provisioning progress via the cloud-init log:
ssh azureuser@<PUBLIC_IP> "tail -f /var/log/cloud-init-progress.log"Expected phases: [init], [nic] (dynamic NIC detection), [complete].
If cloud-init reports errors:
ssh azureuser@<PUBLIC_IP> "sudo cloud-init status --long"End-to-End Test
Section titled “End-to-End Test”Run a full request cycle and verify the response chain:
# First request — MISS (fetches from origin)echo "=== Request 1 (expect MISS) ==="curl -s -o /dev/null -w "HTTP %{http_code} | Cache: %{header:X-Cache-Status}\n" "http://<PUBLIC_IP>/test-path"
# Second request — HIT (served from cache)echo "=== Request 2 (expect HIT) ==="curl -s -o /dev/null -w "HTTP %{http_code} | Cache: %{header:X-Cache-Status}\n" "http://<PUBLIC_IP>/test-path"Expected output:
=== Request 1 (expect MISS) ===HTTP 200 | Cache: MISS=== Request 2 (expect HIT) ===HTTP 200 | Cache: HITVendor Header Verification
Section titled “Vendor Header Verification”Verify all CDN vendor headers are being injected by requesting the /headers path (when using httpbin.org as origin):
curl -s "http://<PUBLIC_IP>/headers" | python3 -m json.toolExpected response includes headers from all five vendors:
{ "headers": { "True-Client-Ip": "<YOUR_CLIENT_IP>", "Cf-Connecting-Ip": "<YOUR_CLIENT_IP>", "Cf-Ipcountry": "US", "Cf-Ray": "<request_id>-SJC", "Cf-Bot-Score": "85", "Cf-Ja3-Hash": "e7d705a3286e19ea42f587b344ee6865", "Cloudfront-Viewer-Country": "US", "Cloudfront-Viewer-City": "San Jose", "Cloudfront-Is-Desktop-Viewer": "true", "Cloudfront-Is-Mobile-Viewer": "false", "Fastly-Client-Ip": "<YOUR_CLIENT_IP>", "X-Akamai-Edgescape": "georegion=263,country_code=US,...", "X-Azure-Clientip": "<YOUR_CLIENT_IP>", "X-Azure-Fdid": "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1", "X-Geo-Country-Code": "US" }}Device Detection Test
Section titled “Device Detection Test”Test with a mobile User-Agent to verify device detection headers change:
curl -s "http://<PUBLIC_IP>/headers?device=mobile" \ -H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)" \ | python3 -m json.tool | grep -E "Is-Mobile|Is-Desktop|is_mobile"Expected:
"Cloudfront-Is-Desktop-Viewer": "false","Cloudfront-Is-Mobile-Viewer": "true",Troubleshooting
Section titled “Troubleshooting”NGINX not running
Section titled “NGINX not running”ssh azureuser@<PUBLIC_IP>sudo systemctl status nginxsudo journalctl -u nginx --no-pager -n 50Cloud-init not finished
Section titled “Cloud-init not finished”After terraform apply, cloud-init takes 2-3 minutes. Check progress:
ssh azureuser@<PUBLIC_IP>sudo cloud-init statussudo tail -f /var/log/cloud-init-output.logCache always showing MISS
Section titled “Cache always showing MISS”- Verify the origin returns cacheable response codes (200, 301, 302)
- Check that the origin does not send
Cache-Control: no-cacheorno-storeheaders - Check NGINX error logs:
sudo tail -f /var/log/nginx/error.log
Connection refused on port 80/443
Section titled “Connection refused on port 80/443”- Verify the NSG rules are applied:
az network nsg rule list --nsg-name "$(terraform output -raw nsg_name)" --resource-group "$(terraform output -raw resource_group_name)" -o table - Verify NGINX is listening:
ssh azureuser@<PUBLIC_IP> "sudo ss -tlnp | grep nginx"