Skip to content

Repository files navigation

Safari ExtensionManifest V3License MIT

Cache Status

A Safari extension that displays CDN cache status (HIT/MISS) for the current page with detailed header information.

Screenshot

Download

Download the latest release from GitHub Releases.

After downloading, unzip and move the app to your Applications folder. On first launch, open Safari → Settings → Extensions and enable Cache Status.

Features

  • Toolbar Badge — Cache status (HIT/MISS) visible at a glance
  • Detailed Popup — View all cache-related HTTP headers
  • Edge Location Mapping — Translates CDN POP codes (e.g., FRA56) to city names (e.g., Frankfurt, DE)
  • Multi-CDN Support — Works with Cloudflare, CloudFront, Fastly, Akamai, Bunny CDN, Varnish, and more
  • Dark Mode — Automatic light/dark theme support

Supported CDNs

CDNDetection HeadersStatus Header
Cloudflarecf-cache-status, cf-raycf-cache-status
CloudFrontx-amz-cf-id, x-amz-cf-popx-cache
Fastlyx-served-by, x-timerx-cache
Akamaix-akamai-request-idx-cache
Bunny CDNcdn-cache, cdn-pullzonecdn-cache
Varnishx-varnishx-cache
Genericx-cachex-cache

Most CDNs use x-cache: HIT from... or x-cache: MISS from..., so the generic detection works for many unlisted CDNs as well.

Cache Status Values

StatusBadgeColorMeaning
HITHIT🟢 GreenServed from CDN cache
MISSMISS🔴 RedFetched from origin server
EXPIREDEXP🟠 OrangeCache expired, refetched from origin
STALESTL🟠 OrangeServing stale content
REVALIDATEDREV🟠 OrangeCache revalidated with origin
REFRESHREF🟠 OrangeCache refreshed from origin
BYPASSBYP⚫ GrayCache bypassed
DYNAMICDYN⚫ GrayDynamic content, not cached

Build & Install

Prerequisites

  • macOS with Xcode installed
  • Safari 14+ (for Web Extension support)

Steps

  1. Open the project in Xcode:

    open "CF Cache Status/CF Cache Status.xcodeproj"
  2. Select your development team in Signing & Capabilities

  3. Build and run (Cmd+R)

  4. Enable the extension:

    • Open Safari → Settings → Extensions
    • Check Cache Status

Development Mode

During development, enable unsigned extensions:

  1. Open Safari
  2. Go to Safari → Settings → Advanced
  3. Check Show Develop menu in menu bar
  4. Go to Develop → Allow Unsigned Extensions

Note: This setting resets each time Safari is quit.

Testing

Run the CDN detection test suite:

just test

Build Commands

The project uses Just for build automation:

just # List all commands
just build-dev # Build for development (unsigned)
just build-release # Build release (unsigned, for testing)
just clean # Clean build artifacts
just xcode # Open project in Xcode

Release Process

See RELEASE.md for the full release guide covering:

  • Direct distribution (GitHub) with notarization
  • Mac App Store submission

Project Structure

CF Cache Status/
├── CF Cache Status/ # macOS container app (SwiftUI)
│ ├── CacheStatusApp.swift
│ ├── ContentView.swift
│ └── Assets.xcassets/
└── CF Cache Status Extension/ # Safari Web Extension
├── content.js # Performance metrics collection
└── Resources/
├── manifest.json # Extension configuration
├── constants.js # Shared CDN detection rules
├── background.js # Header capture & badge updates
├── popup.html/js/css # Popup UI
└── images/
scripts/ # Release automation
tests/ # CDN detection tests
Justfile # Build commands

Permissions

PermissionPurpose
webRequestRead HTTP response headers
webNavigationDetect page navigations
activeTabAccess current tab information
<all_urls>Monitor requests to all websites

How It Works

  1. Navigation Detection — When you navigate to a page, webNavigation.onBeforeNavigate marks the tab as pending
  2. Header CapturewebRequest.onHeadersReceived captures response headers for the main document only
  3. CDN Detection — Headers are analyzed to identify the CDN provider
  4. Status Parsing — Cache status is extracted from CDN-specific headers
  5. Badge Update — Toolbar badge is updated with status text
  6. Popup Display — Clicking the icon shows detailed header information

License

MIT

About

A Safari extension that displays CDN cache status (HIT/MISS) for the current page with detailed header information.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages