# Website Security Headers & HTTPS Audit (`moonweil/website-security-audit`) Actor

Crawl your website for missing or weak security headers (HSTS, CSP, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, frame protection), insecure cookies, mixed content, and HTTP-to-HTTPS gaps. Passive and safe: only reads responses, never probes. Per-page score plus site summary.

- **URL**: https://apify.com/moonweil/website-security-audit.md
- **Developed by:** [Aleksandr Jelohhin](https://apify.com/moonweil) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Website Security Headers & HTTPS Audit

Crawl your website and check every page for the **security configuration mistakes
that leave visitors exposed**: missing or weak security headers, insecure
cookies, mixed content, and HTTP pages that don't redirect to HTTPS. You get a
score per page and a summary across the whole site.

**Passive and safe.** This Actor only reads the responses your server already
sends. It never scans ports, guesses paths, submits forms, or sends any kind of
attack payload — so it's safe to run against production and against sites you
don't own permission to pen-test.

### What it checks

- **HTTPS** — is the page served over HTTPS, and does `http://` redirect to it?
- **Strict-Transport-Security (HSTS)** — present, and is `max-age` long enough?
- **Content-Security-Policy (CSP)**
- **X-Content-Type-Options: nosniff**
- **Referrer-Policy**
- **Permissions-Policy** (and legacy Feature-Policy)
- **Clickjacking protection** — X-Frame-Options or CSP `frame-ancestors`
- **Cookie flags** — `Secure`, `HttpOnly`, `SameSite`
- **Mixed content** — `http://` scripts, styles, images or iframes on an HTTPS page

### Input

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

Give it a list of URLs, or turn on `crawl` to sweep the whole site.

### Output

One dataset row per URL:

```json
{
  "finalUrl": "https://example.com/",
  "score": 78,
  "deductions": [{ "reason": "missing_csp", "points": 15 }],
  "headers": { "hsts": { "present": true, "value": "max-age=63072000" }, "csp": { "present": false } },
  "cookies": { "total": 2, "insecure": 1 },
  "mixedContent": { "count": 0 },
  "warnings": ["missing_csp"]
}
```

Plus a run `SUMMARY`: average score, how many pages miss each header, pages with
insecure cookies or mixed content, and the lowest-scoring pages.

### Use it for

- A quick security hygiene check before or after a launch
- Monitoring header configuration across a large site or many sites
- Producing an evidence trail for a security or compliance review
- CI gates — fail the build if a page's score drops

### Pricing

Pay per URL audited. Unreachable URLs are not charged, and the extra `http://`
request used to check the HTTPS redirect is **not** charged — you only pay for
the URLs you asked for (plus any pages found when `crawl` is on).

# Actor input Schema

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

One or more URLs to analyze. When crawling is on, these are also the crawl seeds.

## `crawl` (type: `boolean`):

Off by default: a security audit usually runs on a fixed list of URLs.

## `maxPages` (type: `integer`):

Hard limit on the number of pages processed. Protects compute cost — the crawl stops once it is reached.

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

How many pages to process in parallel.

## `sameDomainOnly` (type: `boolean`):

Restrict the crawl to the hostname of each start URL (www and apex are treated as equal).

## `includeSubdomains` (type: `boolean`):

Also follow links to subdomains of the start URL's registrable domain.

## `useSitemap` (type: `boolean`):

Seed the crawl from the site's /sitemap.xml (and /sitemap\_index.xml) in addition to the start URLs.

## `respectRobotsTxt` (type: `boolean`):

Skip URLs disallowed by the target site's robots.txt.

## `excludePatterns` (type: `array`):

Glob-style deny patterns for URLs to skip, e.g. /logout, /cart\*, \*.zip

## `checkHttpToHttpsRedirect` (type: `boolean`):

Also request the http:// version of each https:// start URL to verify it redirects.

## `minHstsMaxAgeDays` (type: `integer`):

Minimum Strict-Transport-Security max-age (in days) that counts as adequately configured.

## `outputDetail` (type: `string`):

summary keeps the dataset compact; detailed includes the full analyzer evidence per page.

## `debug` (type: `boolean`):

Verbose logging. Also allows stack traces into the dataset.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://apify.com"
    }
  ],
  "crawl": false,
  "maxPages": 100,
  "maxConcurrency": 5,
  "sameDomainOnly": true,
  "includeSubdomains": false,
  "useSitemap": false,
  "respectRobotsTxt": true,
  "excludePatterns": [],
  "checkHttpToHttpsRedirect": true,
  "minHstsMaxAgeDays": 180,
  "outputDetail": "detailed",
  "debug": false
}
```

# Actor output Schema

## `pages` (type: `string`):

One row per URL: security score and deductions, presence and strength of each security header, cookie flag analysis, mixed-content findings and the HTTP-to-HTTPS redirect result.

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

Average score across the site, how many pages miss each header, pages with insecure cookies or mixed content, and the lowest-scoring pages.

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

// Run the Actor and wait for it to finish
const run = await client.actor("moonweil/website-security-audit").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://apify.com" }] }

# Run the Actor and wait for it to finish
run = client.actor("moonweil/website-security-audit").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://apify.com"
    }
  ]
}' |
apify call moonweil/website-security-audit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,moonweil/website-security-audit"
        }
    }
}

```

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/WwSjIAQjdZgyfJDNc/builds/kFrdFdK9GwpAsACCb/openapi.json
