# HTTP Security Headers Checker (`klyve1/security-headers-checker`) Actor

Audit the HTTP security headers of websites in bulk: HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, cookies flags. Grade A to F with fixes to apply.

- **URL**: https://apify.com/klyve1/security-headers-checker.md
- **Developed by:** [Nico Klyve](https://apify.com/klyve1) (community)
- **Categories:** Developer 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 $1.00 / 1,000 website checkeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-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

## HTTP Security Headers Checker (Grade A to F)

Audit the **HTTP security headers** of one or thousands of websites and get a **score out of 100, a grade from A to F and the exact fixes** to apply. The Actor checks Strict-Transport-Security (HSTS), Content-Security-Policy (CSP), X-Frame-Options or frame-ancestors, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, Cross-Origin-Opener-Policy and Cross-Origin-Resource-Policy, cookie flags (Secure, HttpOnly, SameSite), the http to https redirect and server version leaks.

It sends one normal page request per site (plus one http:// request to test the redirect), like a browser visit. No intrusive scan.

### Who uses it

- **Web agencies and freelancers**: audit client sites in bulk and add the fixes to a quote or a report.
- **Security and compliance teams**: monitor all company domains on a schedule and catch regressions after a deploy.
- **Developers and DevOps**: check a staging or production URL in CI through the API.
- **SEO and IT consultants**: a quick, objective hygiene score for a prospect's website.

### Example output

```json
{
  "url": "https://github.com/",
  "ok": true,
  "finalUrl": "https://github.com/",
  "statusCode": 200,
  "https": true,
  "httpRedirectsToHttps": true,
  "score": 75,
  "grade": "B",
  "headers": {
    "strict-transport-security": { "status": "pass", "value": "max-age=31536000; includeSubdomains; preload" },
    "x-frame-options": { "status": "pass", "value": "deny" },
    "x-content-type-options": { "status": "pass", "value": "nosniff" },
    "referrer-policy": { "status": "pass", "value": "origin-when-cross-origin, strict-origin-when-cross-origin" },
    "permissions-policy": { "status": "fail", "value": null },
    "cross-origin-opener-policy": { "status": "fail", "value": null }
  },
  "cookiesWithIssues": [{ "name": "_octo", "missing": ["HttpOnly"] }],
  "versionLeaks": {},
  "fixes": [
    "Add a Permissions-Policy, e.g. \"camera=(), microphone=(), geolocation=()\".",
    "Add \"Cross-Origin-Opener-Policy: same-origin\" to isolate your browsing context.",
    "Set Secure, HttpOnly and SameSite on cookies: _octo."
  ],
  "responseTimeMs": 297,
  "checkedAt": "2026-11-20T18:01:19.426Z"
}
```

### Scoring

| Header | Points |
|---|---|
| Strict-Transport-Security (max-age of 180 days or more) | 25 |
| Content-Security-Policy (without unsafe-inline, unsafe-eval or wildcards, unless nonces or hashes are used) | 25 |
| X-Frame-Options or CSP frame-ancestors | 10 |
| X-Content-Type-Options: nosniff | 10 |
| Referrer-Policy | 10 |
| Permissions-Policy | 10 |
| Cross-Origin-Opener-Policy | 5 |
| Cross-Origin-Resource-Policy | 5 |

Cookies without Secure, HttpOnly or SameSite remove 5 points. Grades: A 90+, B 75+, C 60+, D 40+, E 20+, F below 20.

### Input

| Field | What it does | Default |
|---|---|---|
| `urls` | Websites or URLs, one per line | |
| `maxConcurrency` | Sites checked in parallel | 5 |

### Pricing

Pay per result: **$0.001 per site checked**. Sites that cannot be loaded are free.

### Good to know

- Redirects are followed, the final page is graded.
- Headers can differ between pages; audit your key pages (home, login, checkout) separately.
- Only check sites you own or have permission to audit. The check is a single standard page request.

# Actor input Schema

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

Websites to audit, one per line (example.com or a full URL). https:// is added when missing. Redirects are followed and the final page is audited.

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

How many sites to check at the same time.

## Actor input object example

```json
{
  "urls": [
    "https://apify.com",
    "https://github.com",
    "example.com"
  ],
  "maxConcurrency": 5
}
```

# Actor output Schema

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

All rows produced by the run.

# 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://apify.com",
        "https://github.com",
        "example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("klyve1/security-headers-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 = { "urls": [
        "https://apify.com",
        "https://github.com",
        "example.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("klyve1/security-headers-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 '{
  "urls": [
    "https://apify.com",
    "https://github.com",
    "example.com"
  ]
}' |
apify call klyve1/security-headers-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,klyve1/security-headers-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/qJDCDZz0g3DHxWXlu/builds/6vn3101SnBg9f4XMk/openapi.json
