# Cache-Control Header Checker - Audit HTTP caching configuration (`scrappy_garden/cache-control-checker`) Actor

Audit HTTP caching response headers (Cache-Control, Expires, ETag, Last-Modified, Vary, Age). Optionally tests conditional revalidation using If-None-Match / If-Modified-Since. Useful for web performance tuning and debugging CDN/browser caching behavior.

- **URL**: https://apify.com/scrappy_garden/cache-control-checker.md
- **Developed by:** [Bikram Adhikari](https://apify.com/scrappy_garden) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Cache-Control Header Checker (HTTP caching audit)

Audit HTTP caching response headers for one or more URLs.

This actor fetches headers and evaluates:

- `Cache-Control`
- `Expires`
- `ETag`
- `Last-Modified`
- `Vary`
- `Age`

Optionally it can perform a **conditional revalidation** request using `If-None-Match` / `If-Modified-Since` (when validators are present) to check whether the server returns **304 Not Modified**.

### Input

- **Start URLs**: URLs to check
- **Use HEAD request first**: Try HEAD and fall back to GET when needed
- **Validate revalidation**: Perform a second conditional request (may double requests)
- **Follow redirects / max redirects**
- **Timeout / max concurrency**
- **Proxy configuration** (optional)

### Output

#### Dataset (per URL)

Each dataset item contains:

- start URL + final URL + HTTP status
- caching policy classification + score (0-100)
- warnings/errors with codes
- parsed caching-related headers
- optional revalidation result

#### Key-value store

- `SUMMARY`: aggregate counts + average score
- `REPORT`: `SUMMARY` plus top issue codes

### Notes

- “Good” caching depends on content type (HTML vs static assets). This actor surfaces signals; interpret results in context.
- Some origins/CDNs vary behavior by request headers (e.g., `Accept-Encoding`), so results can differ from a browser.

### Quick start

Store page: https://apify.com/scrappy_garden/cache-control-checker

Paste this into **Input** and click **Run**:

```json
{
  "startUrls": [
    {
      "url": "https://example.com/"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

### Outputs (what you get)

- **Dataset**: Dataset items typically include fields like: `startUrl`, `finalUrl`, `statusCode`, `redirected`, `cacheScore`, `cachePolicy`, `warningCount`, `errorCount`, `issues`, `checkedAt`.
- **Key-value store**: `REPORT`, `SUMMARY`

### Tips (trust + predictable results)

- Start with 1–3 URLs to validate behavior, then scale up.
- If a target blocks requests, enable Proxy and/or slow down concurrency in Input.
- Use the `SUMMARY` / `REPORT` keys (when present) for automation pipelines and monitoring.

### Related actors

- broken-link-checker (https://apify.com/scrappy_garden/broken-link-checker)
- canonical-url-checker (https://apify.com/scrappy_garden/canonical-url-checker)
- meta-tag-analyzer (https://apify.com/scrappy_garden/meta-tag-analyzer)
- security-headers-checker (https://apify.com/scrappy_garden/security-headers-checker)

### Search keywords

cache control checker, cache-control header checker - audit http caching configuration, website audit, seo

# Actor input Schema

## `startUrls` (type: `array`):

URLs to check for HTTP caching headers.

## `maxUrls` (type: `integer`):

Maximum number of URLs to process.

## `timeoutSecs` (type: `integer`):

Maximum time per HTTP request.

## `useHeadRequest` (type: `boolean`):

If enabled, tries HEAD first and falls back to GET when needed.

## `followRedirects` (type: `boolean`):

If enabled, follows redirects to the final URL.

## `maxRedirects` (type: `integer`):

Maximum number of redirects to follow when followRedirects is enabled.

## `validateRevalidation` (type: `boolean`):

If enabled, performs a second request with If-None-Match / If-Modified-Since (when available) and records whether the server returns 304 Not Modified.

## `userAgent` (type: `string`):

Custom User-Agent string to send with requests.

## `maxConcurrency` (type: `integer`):

Maximum number of URLs processed in parallel.

## `proxyConfiguration` (type: `object`):

Proxy settings for accessing websites.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://example.com"
    },
    {
      "url": "https://www.cloudflare.com/favicon.ico"
    }
  ],
  "maxUrls": 50,
  "timeoutSecs": 30,
  "useHeadRequest": true,
  "followRedirects": true,
  "maxRedirects": 10,
  "validateRevalidation": false,
  "userAgent": "ApifyActor Cache-Control Checker (+https://apify.com)",
  "maxConcurrency": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://example.com"
        },
        {
            "url": "https://www.cloudflare.com/favicon.ico"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrappy_garden/cache-control-checker").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "startUrls": [
        { "url": "https://example.com" },
        { "url": "https://www.cloudflare.com/favicon.ico" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("scrappy_garden/cache-control-checker").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://example.com"
    },
    {
      "url": "https://www.cloudflare.com/favicon.ico"
    }
  ]
}' |
apify call scrappy_garden/cache-control-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrappy_garden/cache-control-checker"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/WYzWmpDZMGkiqGbXp/builds/D4VbJNHZVKoPhbUo0/openapi.json
