# HTTP Header Inspector: Security Headers Grade (`ucchiii/http-header-inspector`) Actor

Check the response headers of many URLs in bulk: security header grade (HSTS, CSP, X-Frame-Options, cookies and more) plus caching, compression and server info. One HEAD or GET per URL, no crawling. Empty input runs a free demo.

- **URL**: https://apify.com/ucchiii/http-header-inspector.md
- **Developed by:** [Actor Factory](https://apify.com/ucchiii) (community)
- **Categories:** Developer tools, SEO tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.49 / 1,000 inspected urls

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## 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

**Check the security, caching and compression headers of a list of URLs**

**For web teams, agencies and security reviewers who need a quick look at response headers across many pages.** Give it URLs and get one dataset row per URL: an **A to F grade, a 0 to 100 score, every check with its reason**, and the headers that matter. It sends **one HEAD request per URL** (GET only if the server refuses HEAD), never reads the page body and never crawls. **$0.0007 per graded URL ($0.70 per 1,000); the $5 monthly free credit covers about 7,000 URLs.** Leave the input empty for a free demo.

**Output example** (one row per URL; shortened):

```json
{"url": "https://example.com", "finalUrl": "https://example.com/", "statusCode": 200, "grade": "C", "score": 71,
 "checks": {"strict-transport-security": {"status": "absent", "value": null, "reason": "No Strict-Transport-Security header.", "scored": true},
            "x-content-type-options": {"status": "pass", "value": "nosniff", "reason": "nosniff is set.", "scored": true}},
 "headers": {"server": "nginx", "content-type": "text/html; charset=UTF-8"}, "error": null}
```

### Who it is for and what problem it solves

- **Pre-launch checks for a website.** Before a release or a migration, see which pages are missing HSTS, a Content-Security-Policy, clickjacking protection or safe cookie flags, in one table instead of opening browser dev tools page by page.
- **First pass of a security review.** Compare dozens of hosts or subdomains by grade and spot the ones that need a closer look. This is a header check, not a vulnerability test (see below).
- **CDN and cache checks.** See Cache-Control, ETag, Last-Modified, Content-Encoding (gzip, br) and the Content-Type charset for a list of URLs, and whether the server or framework announces itself through `Server` or `X-Powered-By`.
- **http to https.** For `http://` URLs, check that the first hop redirects to `https://`, and with which status code.

### What it checks

Scored checks (weights add up to 100; checks that do not apply are left out of the score):

| Check | Points | Pass | Warn | Fail / absent |
|---|---|---|---|---|
| `https-redirect` (http URLs only, first hop) | 10 | 301 or 308 to https | 302, 303 or 307 to https | no redirect, or stays on http |
| `strict-transport-security` (https only) | 15 | max-age of 180 days or more | shorter max-age | missing, max-age=0 or unreadable |
| `content-security-policy` | 20 | set, no unsafe-inline or unsafe-eval | contains one of them, or report-only | missing |
| `clickjacking-protection` | 10 | X-Frame-Options DENY or SAMEORIGIN, or CSP frame-ancestors (not `*`) | ALLOW-FROM | missing, other value or `frame-ancestors *` |
| `x-content-type-options` | 10 | nosniff | | missing or other value |
| `referrer-policy` | 8 | no-referrer, same-origin, strict-origin, strict-origin-when-cross-origin | origin, origin-when-cross-origin, no-referrer-when-downgrade | missing, or unsafe-url |
| `permissions-policy` | 5 | set | only the old Feature-Policy | missing |
| `cross-origin-opener-policy` | 4 | same-origin or same-origin-allow-popups | unsafe-none | missing |
| `cross-origin-resource-policy` | 3 | same-origin, same-site or cross-origin | other value | missing |
| `cookies` (only if Set-Cookie is sent) | 10 | all have Secure, HttpOnly and SameSite | missing HttpOnly or SameSite | any cookie without Secure |
| `server-disclosure` | 5 | no version number in Server, no X-Powered-By | version number or X-Powered-By shown | |

Each pass earns the full points, each warn half, each fail or absent none. **Score = points earned / points possible x 100**, and the grade is **A** from 90, **B** from 80, **C** from 70, **D** from 55, **E** from 40, otherwise **F**.

Information checks (shown in `checks` with `scored: false`, not part of the score): `cache-control`, `etag`, `last-modified`, `content-encoding` (gzip, br, zstd, deflate) and `content-type-charset`. HEAD answers from some servers leave out `Content-Encoding`; choose GET to see it.

### The grade is a guide, not a security audit

The grade only reflects which response headers a URL sends. It is a rough first look, **not a vulnerability scan or penetration test**, and a high grade does not mean a site is secure or a low grade that it is vulnerable. Some headers do not suit every site, and the weights are a simple rule of thumb. The Actor makes no attempt to find or exploit weaknesses.

### How it works

- **Input:** `urls` (a list; a missing scheme is filled in as `https://`) and/or `datasetIds` plus `urlField` to read URLs from datasets. Duplicates are removed. Up to 10,000 URLs per run.
- **Method:** `HEAD` by default. If a server answers HEAD with 405 or 501, the same URL is requested once with `GET`. With `GET` chosen, the body is still not read: the connection is closed after the headers.
- **Redirects:** followed up to 5 hops (`followRedirects`, on by default). The headers are graded on the final response; the http to https check looks at the first hop only. A chain longer than 5 hops, or a loop, gives `too_many_redirects` or `redirect_loop` and no grade.
- **Other options:** `userAgent`, `timeoutSecs` (default 15), `concurrency` (default 10, up to 30).
- **Polite by design:** at most 2 requests per second to the same host and 2 connections at a time. Many URLs on one host take proportionally longer.
- **One request per URL:** no retries, no robots.txt or sitemap lookups, no crawling.
- **Set a maximum cost per run** to cap spend: when it is reached the run stops cleanly and the status message and `SUMMARY` (`stoppedAtChargeLimit`, `notInspected`) say how many URLs were left.

### Safe by design

- **Internal addresses are never contacted.** Hostnames are resolved and anything that points to localhost, private ranges, link-local (such as 169.254.169.254) or similar is refused, also at every redirect hop. Such rows have `error: "blocked_private_address"`.
- **Cookie values are never stored.** `Set-Cookie` is shown as `[REDACTED]` with only the number of cookies; the cookie check reads names and flags, not values. No cookies are sent back.
- Logs contain run counts only, no URLs or header values.

### Pricing

**$0.0007 per URL that answered and was graded** (any HTTP status counts; a 404 page is graded too). **Not charged:** URLs with no answer (timeouts, DNS failures), invalid URLs, URLs blocked by the internal-address guard, redirect chains that fail, and the free demo. Store discounts apply automatically: BRONZE -10%, SILVER -20%, GOLD -30%. On the Apify Free plan the $5 monthly credit covers about **7,000 URLs**.

### Input

```json
{ "urls": ["https://example.com", "http://example.org"], "method": "HEAD", "followRedirects": true, "concurrency": 10 }
```

### Output fields

`url`, `finalUrl`, `statusCode`, `grade`, `score`, `checks` (per check: `status` pass, warn, fail or absent; `value`; `reason`; `scored`), `headers` (selected response headers), `method` (HEAD or GET actually used), `redirectCount`, `elapsedMs`, `error`, and `_demo` on demo rows. When no answer is graded, `grade`, `score` and `checks` are `null` and `error` is e.g. `dns_failure`, `timeout`, `connection_error: ...`, `invalid_url`, `blocked_private_address`, `too_many_redirects` or `redirect_loop`. Rows are written as they finish; use `index` to restore the input order. Run totals are saved as `SUMMARY` in the key-value store.

### Notes

Only inspect sites you are allowed to contact. The Actor sends a normal request to each URL you list and nothing else. Known limit: the internal-address check happens just before connecting; a DNS server that changes its answer between the check and the connection (DNS rebinding) is not covered.

### FAQ

**Does a good grade mean the site is secure?** No. It means the URL sends the headers this tool looks for. It is not a vulnerability scan.

**Why is a header "absent" and not "fail"?** `absent` means the header is not sent; `fail` means it is sent with a harmful or invalid value. Both earn no points.

**Why did HSTS or cookies show "not applicable"?** HSTS counts only on https responses, and the cookie check only when the response sets cookies. Those checks are left out of the score instead of lowering it.

**Why is Content-Encoding missing with HEAD?** Some servers leave it out for HEAD. Use `method: GET`; the body is still not read.

**Does it check every page of a site?** Only the URLs you list. It does not follow links.

**Can I test a site behind a login or on my internal network?** No. Internal addresses are blocked and no credentials are sent.

### More tools from the same developer

- [Redirect Checker](https://apify.com/ucchiii/redirect-checker) — full redirect chain for each URL, hop by hop, with loop detection
- [Bulk URL Status Checker](https://apify.com/ucchiii/url-status-checker) — bulk HTTP status and redirect-chain checker for URL lists
- [SSL Certificate Expiry Checker](https://apify.com/ucchiii/ssl-certificate-checker) — SSL/TLS certificate expiry dates, issuer and validity for many hosts, soonest first
- [Bulk HTTP Request Runner](https://apify.com/ucchiii/bulk-http-request) — send many HTTP requests (GET/POST/...) from a list and collect status, headers and body
- [SEO Audit Tool](https://apify.com/ucchiii/seo-audit-tool) — on-page SEO audit for URL lists and sitemaps: title, meta description, h1, canonical, noindex, robots.txt, issues and a 0-100 score

# Actor input Schema

## `urls` (type: `array`):

URLs to inspect, one per line. A missing scheme is filled in as https://. Only these URLs (and the redirects they answer with) are requested. Up to 10,000 per run. Leave empty (and no dataset) for a free demo.

## `datasetIds` (type: `array`):

Optional. IDs (or Console links) of datasets whose items hold URLs, for example the output of a sitemap or scraper run. Added to the URLs above.

## `urlField` (type: `string`):

Name of the dataset field that holds the URL (default 'url').

## `method` (type: `string`):

HEAD asks for headers only. If a server answers HEAD with 405 or 501, the same URL is requested once with GET. Choose GET to see Content-Encoding on servers that omit it for HEAD. The page body is never read.

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

Follow redirects (up to 5) and grade the final response. The http to https check always looks at the first hop only. Every hop is checked against the internal-address block.

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

Optional. Value of the User-Agent header. Leave empty to use the default, which names this Actor.

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

Timeout for each request. A URL that does not answer in time gets error timeout and is not charged.

## `concurrency` (type: `integer`):

How many URLs are inspected at the same time (1 to 30). Requests to the same host start at most 2 per second.

## Actor input object example

```json
{
  "urls": [
    "https://example.com",
    "https://www.python.org",
    "https://www.wikipedia.org"
  ],
  "urlField": "url",
  "method": "HEAD",
  "followRedirects": true,
  "timeoutSecs": 15,
  "concurrency": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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 = {
    "urls": [
        "https://example.com",
        "https://www.python.org",
        "https://www.wikipedia.org"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ucchiii/http-header-inspector").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 = { "urls": [
        "https://example.com",
        "https://www.python.org",
        "https://www.wikipedia.org",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ucchiii/http-header-inspector").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 '{
  "urls": [
    "https://example.com",
    "https://www.python.org",
    "https://www.wikipedia.org"
  ]
}' |
apify call ucchiii/http-header-inspector --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ucchiii/http-header-inspector"
        }
    }
}
```

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/vSNY9QgZVxPGCWjRN/builds/RMj80xAfK3TQtm5u5/openapi.json
