Home/Tools/GEO & Edge Inspector

GEO & Edge Network Header Inspector & CIDR Calculator

Debug Cloudflare, Vercel, and AWS CloudFront edge request headers. Perform bitwise CIDR subnet arithmetic and map multi-hop HTTP redirection chains with latency profiling.

Module 2Edge Proxy Diagnostics • Subnet Arithmetic

GEO & Edge Network Inspector

Edge Simulation Controls:
Simulated Edge Proxy Headers:
Host:api.netfox.space
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36
X-Forwarded-For:203.0.113.195, 172.70.142.22
X-Forwarded-Proto:https
X-Forwarded-Port:443
X-Real-IP:203.0.113.195
CF-Connecting-IP:203.0.113.195
CF-IPCountry:US
CF-Ray:x03bkstyagfqkvgi-SFO
CF-Visitor:{"scheme":"https"}
CF-IPCity:San Francisco
CF-IPContinent:NA
CF-IPLatitude:37.7749
CF-IPLongitude:-122.4194
CF-Postal-Code:94107
CF-Timezone:America/Los_Angeles
CF-Connecting-IPv6:
x-vercel-ip-country:US
x-vercel-ip-country-region:CA
x-vercel-ip-city:San%20Francisco
x-vercel-ip-latitude:37.7749
x-vercel-ip-longitude:-122.4194
x-vercel-ip-timezone:America/Los_Angeles
x-vercel-proxied-for:203.0.113.195
CloudFront-Viewer-Country:US
CloudFront-Viewer-Country-Name:United States
CloudFront-Viewer-Country-Region:CA
CloudFront-Viewer-City:San Francisco
CloudFront-Viewer-Postal-Code:94107
CloudFront-Viewer-Time-Zone:America/Los_Angeles
CloudFront-Forwarded-Proto:https
CloudFront-Is-Desktop-Viewer:true
CloudFront-Is-Mobile-Viewer:false
Fastly-Client-IP:203.0.113.195
True-Client-IP:203.0.113.195
export default {
  async fetch(request, env, ctx) {
    // Cloudflare Edge Geolocation Properties
    const clientIp = request.headers.get('CF-Connecting-IP');
    const country = request.cf?.country || request.headers.get('CF-IPCountry');
    const city = request.cf?.city;
    const asn = request.cf?.asn;
    const botScore = request.cf?.botManagement?.score;

    console.log(`Edge Request from ${country} (${city}), IP: ${clientIp}, ASN: ${asn}`);

    // Geo-fencing example:
    if (country === 'BLOCKED_COUNTRY') {
      return new Response('Access Denied from this region', { status: 403 });
    }

    return fetch(request);
  }
};
AdvertisementNetfox Developer Network Sponsor Slot

Edge Computing Architecture & Geolocation Header Semantics

In modern serverless architectures, Edge workers run in globally distributed data centers within milliseconds of end users. When an incoming TCP/TLS handshake is terminated at an edge Point of Presence (PoP), the proxy extracts the source socket address and queries local MaxMind or proprietary ASN routing tables.

Headers like CF-IPCountry, X-Forwarded-For, and CloudFront-Viewer-Country allow origin applications to enforce geo-fencing, detect fraud, and customize currency without conducting expensive external IP lookups.

IPv4 & IPv6 CIDR Subnet Bitwise Arithmetic

Subnet masks delineate network boundaries from assignable host pools:

  • Usable Hosts: A /24 provides 256 total addresses, with 254 usable hosts (network address .0 and broadcast address .255 reserved).
  • Point-to-Point Links: A /31 (RFC 3021) allocates exactly 2 usable host addresses for router-to-router links.
  • Private Subnets: Defined under RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and CGNAT under RFC 6598 (100.64.0.0/10).

Redirect Chains & Edge Cache Invalidation

Chained redirections create compounding latency penalties. By utilizing Netfox's visual redirect mapper, DevOps engineers can detect unnecessary intermediate hops (such as http:// → https:// → trailing slash → language route) and collapse them into a single 301/308 response served directly from edge cache memory.

AdvertisementNetfox Developer Network Sponsor Slot

GEO & Edge Diagnostics FAQ

Frequently asked questions on edge proxy headers, CIDR subnet masks, and redirect latency optimization.

What are Edge Proxy Headers and why do CDN providers inject them?

When traffic passes through global Edge CDNs (like Cloudflare, Vercel Edge, Fastly, or AWS CloudFront), the proxy terminates the client connection and forwards the request to your origin. The edge injects headers such as CF-Connecting-IP, X-Forwarded-For, and CF-IPCountry so origin servers can detect the real visitor IP, geolocation country, and ASN without resolving DNS.

How is CIDR subnet arithmetic calculated?

Classless Inter-Domain Routing (CIDR) uses a bitmask prefix length (e.g. /24 in IPv4) to separate the network portion from host identifiers. Bitwise ANDing the IP with the netmask produces the Network Address, while ORing with the wildcard mask yields the Broadcast Address.

Why should redirect chains never exceed 2 hops?

Each redirect hop introduces an additional round-trip time (RTT) DNS/TLS negotiation latency penalty (often 50-150ms per hop). Furthermore, search engine crawlers (Googlebot) may stop following redirect chains after 3 to 5 hops, causing indexation failure and loss of link equity.

What is the difference between 301 and 308 permanent redirects?

A 301 redirect allows browsers to change the HTTP request method from POST to GET on the destination. A 308 Permanent Redirect (RFC 7538) guarantees that the HTTP request method and body remain unchanged on the redirected request.