Skip to content

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.

Verify NGINX is running and responding:

Terminal window
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:

Terminal window
curl -s "$(terraform output -raw health_check_url)" | jq .

The first request to any path will be a cache miss — the edge fetches from origin:

Terminal window
curl -I "http://<PUBLIC_IP>/"

Look for these headers in the response:

X-Cache-Status: MISS
X-CDN-Edge: cdn-simulator

MISS means the content was not in cache and was fetched from the origin server.

Repeat the same request immediately:

Terminal window
curl -I "http://<PUBLIC_IP>/"

Expected headers:

X-Cache-Status: HIT
X-CDN-Edge: cdn-simulator

HIT confirms the response was served from the NGINX disk cache without contacting the origin.

SSH into the VM to verify cached content exists on disk:

Terminal window
ssh azureuser@<PUBLIC_IP>
# Check cache directory has content
sudo find /var/cache/nginx/cdn -type f | head -20
# Check cache size
sudo du -sh /var/cache/nginx/cdn

Verify NGINX is running and the configuration is valid:

Terminal window
ssh azureuser@<PUBLIC_IP>
# Check service status
sudo systemctl status nginx
# Validate configuration
sudo nginx -t
# View active connections (if stub_status is enabled)
curl -s http://localhost/health

Verify the edge node can reach the origin server:

Terminal window
ssh azureuser@<PUBLIC_IP>
# Test connectivity to origin (replace with your origin URL)
curl -I "https://your-origin.example.com/"

If this fails, check:

  1. The origin_server variable is correct in the Terraform config
  2. The origin server allows inbound connections from the edge node’s public IP
  3. DNS resolution works from the VM (nslookup your-origin.example.com)

Monitor provisioning progress via the cloud-init log:

Terminal window
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:

Terminal window
ssh azureuser@<PUBLIC_IP> "sudo cloud-init status --long"

Run a full request cycle and verify the response chain:

Terminal window
# 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: HIT

Verify all CDN vendor headers are being injected by requesting the /headers path (when using httpbin.org as origin):

Terminal window
curl -s "http://<PUBLIC_IP>/headers" | python3 -m json.tool

Expected 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"
}
}

Test with a mobile User-Agent to verify device detection headers change:

Terminal window
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",
Terminal window
ssh azureuser@<PUBLIC_IP>
sudo systemctl status nginx
sudo journalctl -u nginx --no-pager -n 50

After terraform apply, cloud-init takes 2-3 minutes. Check progress:

Terminal window
ssh azureuser@<PUBLIC_IP>
sudo cloud-init status
sudo tail -f /var/log/cloud-init-output.log
  • Verify the origin returns cacheable response codes (200, 301, 302)
  • Check that the origin does not send Cache-Control: no-cache or no-store headers
  • Check NGINX error logs: sudo tail -f /var/log/nginx/error.log
  • 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"