Skip to main content

Compression Check API

free
GET/v1/domain/compression

Tests HTTP compression support by individually probing gzip, Brotli, zstd, and deflate encodings. Measures uncompressed and compressed sizes to calculate compression ratios. Detects CDN providers and checks for proper Vary: Accept-Encoding headers to prevent cache poisoning.

What It Does

Makes separate requests with individual Accept-Encoding headers (gzip, br, zstd, deflate, identity) to determine exactly which compression algorithms the server supports. Measures the uncompressed baseline size and each encoding's compressed size to calculate compression ratios. Detects the CDN provider, checks the Vary header for correct caching behavior, and identifies the server's preferred encoding when given a full browser-like Accept-Encoding header.

Why It's Useful

Compression can reduce page size by 60-90% for text-based content. Verifying each encoding individually reveals exactly what the server supports — not just what it prefers. Missing Vary: Accept-Encoding headers can cause CDN cache poisoning, where users receive incorrect compressed/uncompressed responses.

Use Cases

Performance Engineer

Performance Optimization

Verify compression is enabled and compare encoding efficiency (gzip vs Brotli vs zstd) as part of web performance optimization.

Identify missing or suboptimal compression with exact byte savings per encoding.

DevOps Engineer

CDN Configuration

Verify CDN is properly compressing responses and serving correct Vary headers to prevent cache poisoning.

Ensure CDN compression settings and caching behavior are correctly configured.

Technical SEO

Competitive Benchmarking

Compare compression implementation across competitor sites to identify performance gaps.

Benchmark compression ratios and encoding support against competitors.

Infrastructure Engineer

Bandwidth Cost Analysis

Measure actual compression ratios to estimate bandwidth savings and CDN cost reduction.

Quantify the bandwidth and cost impact of enabling or upgrading compression.

Parameters

NameLocationTypeRequiredDescription
domainquerystringRequiredDomain or full URL — accepts `example.com` or `https://example.com/path`.Example: https://example.com

Response Fields

Result fields below are inside the JSON data object. Any row named meta describes the sibling response metadata object. See response and error handling for status codes and error responses. Optional observations may be absent or null; inspect warnings and partial-failure fields before treating a missing result as a negative finding.

FieldTypeDescription
domainstringThe queried domain (bare hostname).
urlstringFull URL that was fetched, echoing the protocol used in the request.
statusCodenumberHTTP status code of the response
contentTypestringContent-Type of the response
isCompressedbooleanWhether any compression encoding is supported
isCompressiblebooleanWhether the content type benefits from compression (text/*, JSON, XML, SVG)
encodingstringThe server's preferred encoding when given a full browser-like Accept-Encoding header
encodingsobjectPer-encoding test results (gzip, brotli, zstd, deflate). Each includes supported, compressedSize (null on chunked-encoding origins for gzip/br — flagged via note), compressionRatio, contentEncoding, note (chunked-encoding indicator), and qualityHint (low/default/high inferred from ratio + content type)
uncompressedSizenumberUncompressed response size in bytes (baseline measurement)
compressedSizenumberBest compressed size in bytes
compressionRationumberBest compression ratio (e.g., 0.77 = 77% size reduction)
bestEncodingstringThe encoding that achieved the best compression ratio
varyAcceptEncodingbooleanWhether the Vary header includes Accept-Encoding (critical for CDN correctness)
serverstringServer header value
cdnobjectCDN detection result (detected, provider, cacheStatus, edgeLocation). Detects 22+ providers including Cloudflare, Fastly, CloudFront, Vercel, Akamai, Netlify, Edgio, CDN77, Section.io, ArvanCloud, StackPath, Tencent, GCS, Azure Storage
summarystringHuman-readable summary of the compression analysis
issuesarrayCompression issues detected (missing compression, missing Vary header, double-encoding, etc.)
recommendationsarrayActionable compression optimization suggestions — content-type-aware (HTML/JSON vs static assets) with encoder quality guidance
timestampstringISO 8601 timestamp of the analysis

Code Examples

Replace YOUR_API_KEY with your API key. This endpoint requires the free plan or higher; see plans and usage limits.

cURL
curl --request GET 'https://api.edgedns.dev/v1/domain/compression?domain=https%3A%2F%2Fexample.com' \
  --header "Authorization: Bearer YOUR_API_KEY"
JavaScript
const response = await fetch(
  "https://api.edgedns.dev/v1/domain/compression?domain=https%3A%2F%2Fexample.com",
  {
    "method": "GET",
    "headers": {
      "Authorization": "Bearer YOUR_API_KEY"
    }
  }
);

if (!response.ok) {
  throw new Error(`EdgeDNS returned HTTP ${response.status}`);
}
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    'GET',
    "https://api.edgedns.dev/v1/domain/compression?domain=https%3A%2F%2Fexample.com",
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    timeout=60,
)
response.raise_for_status()
data = response.json()
print(data)

Read the full Compression Check guide

Learn the concepts, choose a practical workflow, and interpret the observations from Compression Check before acting on them. Run supported checks via MCP or through REST.

Read the guide →

    Related Endpoints

    External References

    Learn more about the standards and protocols behind this endpoint.

    Try This Endpoint

    Test the Compression Check endpoint live in the playground.

    Compression Check API Reference | EdgeDNS