# HTTP Security Headers Checker - Grade & Fixes (`devoted_laureate_r8f/audit-des-en-t-tes-de-s-curit-http`) Actor

Audit the HTTP security headers of any URL (CSP, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, Cross-Origin-Opener/Resource-Policy) and get a score, a letter grade and concrete fixes.

- **URL**: https://apify.com/devoted_laureate_r8f/audit-des-en-t-tes-de-s-curit-http.md
- **Developed by:** [Billy Zouz](https://apify.com/devoted_laureate_r8f) (community)
- **Categories:** Developer tools, SEO tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.00 / 1,000 url auditeds

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 Auditor

Checks the HTTP response headers of any public URL against a set of well-known
security header recommendations — Content-Security-Policy, Strict-Transport-Security,
X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and the
Cross-Origin-Opener-Policy / Cross-Origin-Resource-Policy pair. You get back a 0-100
score, a letter grade, and a list of concrete fixes for anything missing or weakly
configured.

### What it does

The Actor sends a single HTTP request to the URL you provide, reads the response
headers (following redirects by default), and runs each of the eight headers above
through a weighted check: a header can be fully present and correctly configured, present
but weak (e.g. a short `max-age` on HSTS, or `unsafe-inline` in a CSP), or missing
entirely. Weights are summed into a score out of 100 and mapped to a letter grade
(A ≥ 90, B ≥ 75, C ≥ 60, D ≥ 40, F below that).

### Input

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `url` | string | yes | — | Full URL of the site to audit (e.g. `https://example.com`). |
| `followRedirects` | boolean | no | `true` | Follow HTTP redirects before analyzing the headers. |
| `timeoutMs` | integer | no | `10000` | Maximum time to wait for the HTTP response, in milliseconds. |

### Output

One dataset row per run:

| Field | Description |
|---|---|
| `url` | Final URL analyzed, after any redirects. |
| `statusCode` | HTTP status code returned by the server. |
| `headersPresent` | Security headers detected in the response. |
| `headersMissing` | Recommended security headers absent from the response. |
| `score` | Overall header security score, from 0 to 100. |
| `grade` | Letter grade (A–F) matching the score. |
| `recommendations` | Concrete advice for fixing missing or misconfigured headers. |

If the request fails (invalid URL, timeout, DNS error, etc.), the row instead
contains `url` and an `error` message, and no charge is made.

### Pricing

Pay per event: **$0.004 per url audited**. One URL's response headers fetched, scored and graded with recommendations (charged even when every header is already correct).

You only pay for these events: the platform usage of the run is covered by the Actor. Failed fetches are not charged. You can cap the cost of a run with the maximum charge setting of your run.

### Limits

- One URL per run; only publicly reachable HTTP(S) endpoints are supported.
- No authentication, proxy, or personal data handling — only the target site's
  public response headers are read.
- Very slow or unresponsive servers will fail once `timeoutMs` is reached.

### Use in your workflow

Replace `<APIFY_TOKEN>` with your token from Apify Console → Settings → API & Integrations.

**HTTP API (curl)** — run and get the results in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/devoted_laureate_r8f~audit-des-en-t-tes-de-s-curit-http/run-sync-get-dataset-items" \
  -H "Authorization: Bearer <APIFY_TOKEN>" -H "Content-Type: application/json" \
  -d '{"url": "https://www.wikipedia.org/", "followRedirects": true, "timeoutMs": 10000}'
```

**JavaScript** (`npm install apify-client`):

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('devoted_laureate_r8f/audit-des-en-t-tes-de-s-curit-http').call({"url": "https://www.wikipedia.org/", "followRedirects": true, "timeoutMs": 10000});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**Python** (`pip install apify-client`):

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("devoted_laureate_r8f/audit-des-en-t-tes-de-s-curit-http").call(run_input={"url": "https://www.wikipedia.org/", "followRedirects": True, "timeoutMs": 10000})
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)
```

**AI agents (MCP)** — expose only this Actor as a tool through the Apify MCP server:

```json
{
  "mcpServers": {
    "security-headers-check": {
      "url": "https://mcp.apify.com?tools=devoted_laureate_r8f/audit-des-en-t-tes-de-s-curit-http",
      "headers": {
        "Authorization": "Bearer <APIFY_TOKEN>"
      }
    }
  }
}
```

For agents: call it when you need to know whether a website sends the recommended HTTP security headers. Input: `url` (one page); optional `followRedirects`, `timeoutMs`. Output: one record with a score, a letter grade, the headers present/missing and a recommendation per issue. Cost: $0.004 per url audited; failures are not charged.

### FAQ

**Which headers are checked?**

Content-Security-Policy, Strict-Transport-Security, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, Cross-Origin-Opener-Policy and Cross-Origin-Resource-Policy.

**How is the grade computed?**

Each header contributes to a score from its presence and configuration; the score maps to a letter grade, and every missing or weak header comes with a recommendation.

**Am I charged if all headers are fine?**

Yes, one event per URL audited: you still receive the full audit and grade.

### Related tools

- [Website Tech Stack Detector - CMS & Frameworks](https://apify.com/devoted_laureate_r8f/d-tection-de-stack-technique-d-un-site) — know the server/CDN/CMS before fixing headers

# Actor input Schema

## `url` (type: `string`):

Full URL of the site to audit (e.g. https://example.com).

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

If true, follow HTTP redirects before analyzing the headers.

## `timeoutMs` (type: `integer`):

Maximum time to wait for the HTTP response, in milliseconds.

## Actor input object example

```json
{
  "url": "https://example.com",
  "followRedirects": true,
  "timeoutMs": 10000
}
```

# Actor output Schema

## `results` (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 = {
    "url": "https://example.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("devoted_laureate_r8f/audit-des-en-t-tes-de-s-curit-http").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 = { "url": "https://example.com" }

# Run the Actor and wait for it to finish
run = client.actor("devoted_laureate_r8f/audit-des-en-t-tes-de-s-curit-http").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 '{
  "url": "https://example.com"
}' |
apify call devoted_laureate_r8f/audit-des-en-t-tes-de-s-curit-http --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devoted_laureate_r8f/audit-des-en-t-tes-de-s-curit-http"
        }
    }
}
```

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/SPYeQEMjf9YgAXFru/builds/x11QyHnq1EFjtixIU/openapi.json
