Quick Start
Get CSP reporting working in 5 minutes.
1. Create a Site in HeaderHawk
Section titled “1. Create a Site in HeaderHawk”- Sign up at app.headerhawk.com
- HeaderHawk asks one question: which site you want to watch. Enter its
address, such as
www.example.com. That host becomes the site, named after it, and for awww.address the bare domain is offered too (orwww.for a bare domain), ticked, since a site that lists only one of the two discards the other’s reports. More hosts, wildcards and another name are under Settings → Sites → Edit. - The Overview opens on your page’s grade — the one the free site scanner gives it, with the security headers it lacks — and then your first step: choosing where the site’s Content-Security-Policy comes from (step 3 below).
- Each site’s endpoint is in its setup panel: choose the site in the site switcher at the top of the dashboard, then Set up this site, or choose its row under Settings → Sites. A site you add from there opens its panel as soon as it is created. Copy the Endpoint — the full URL, already carrying your site’s ingest code as the first part of the host:
https://your-ingest-code.ingest.us.headerhawk.com/rPaste the whole URL. The ingest code is the only site-specific part, and it is
the value every example below writes as your-ingest-code. A site created
before ingest codes moved into the host also has an earlier URL,
https://ingest.us.headerhawk.com/r/ followed by an 8-character code, which the
setup panel names under this one; headers that already use it keep working.
On the Professional plan and above you can give the site a
report host name of your own,
such as acme-shop, in the same panel, and copy that URL instead. On the
Business plan and above it can receive reports on
a hostname of your own domain,
such as csp.example.com.
2. Add CSP Headers
Section titled “2. Add CSP Headers”Choose your platform:
3. Choose Where Your Policy Comes From
Section titled “3. Choose Where Your Policy Comes From”A new site’s first step offers two paths, side by side:
- Build a policy from my traffic (recommended) starts discovery, below.
- I’ll use my own policy is for a site that already serves a Content-Security-Policy, or will write one. It starts no discovery run: add two reporting lines to your policy instead, as in Already have a policy?
You can change your mind either way. A site on its own policy can start discovery from Policy › Draft at any time, and a site running discovery can switch from its setup panel, which stops the run.
Build a policy from my traffic
Section titled “Build a policy from my traffic”Discovery runs for two weeks, and the site’s Overview and setup panel then show the two headers to add, at the top of its Response headers block:
Reporting-Endpoints: headerhawk="https://your-ingest-code.ingest.us.headerhawk.com/r", headerhawk-discovery="https://your-ingest-code.ingest.us.headerhawk.com/r/discovery"Content-Security-Policy-Report-Only: default-src 'none'; script-src 'report-sample'; style-src 'report-sample'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; report-uri https://your-ingest-code.ingest.us.headerhawk.com/r/discovery; report-to headerhawk-discoveryThe policy is report-only and allows nothing, so it blocks nothing: each visitor’s browser reports every script, style, image, font, frame and connection your pages load. After a week, HeaderHawk proposes a policy built from what they reported, with the evidence behind each source. Build a Policy From Your Traffic covers the run and the proposal in full.
4. Check Your Headers
Section titled “4. Check Your Headers”Once the headers are pasted, choose Check my headers, on the Overview’s
step or beside the block in the site’s setup panel. HeaderHawk fetches the
site’s page once and says, for each line of the block whether it is
served, different (served, but not as written, with
what differs: another site’s ingest code, a report-to group that
Reporting-Endpoints does not define, a missing report-uri, or the discovery
policy served as the enforcing Content-Security-Policy, which blocks
everything) or missing. A header served twice, or as one value joined by a
comma, counts. One header carrying the block’s other lines inside its value
does not: that is the block pasted into a field that takes one line, which
browsers ignore, so the check says so, and that each line must be a header of
its own. It does not wait for a visitor, so a CDN or framework that drops
or rewrites the header shows up straight away rather than as a silence.
The page is https:// and the site’s first host that is not a wildcard; give
another page’s URL in the setup panel, which must be on one of the site’s
hosts. Redirects are followed only while they stay on those hosts, and a
header that only a redirect serves is pointed out, because a browser keeps
only the headers of the page it lands on. The request says
HeaderHawkScanner in its user agent. Each site can be checked ten times an
hour, and your sites thirty times between them, and every member of the team but a viewer can run it.
When every line is served and reports still do not arrive, the cause is in the browser, which a fetch cannot see: a content blocker, or a page on a host the site does not list.
5. Follow Your Next Step
Section titled “5. Follow Your Next Step”The Overview shows the site’s next step. On discovery’s path: review the proposal, deploy it in report-only, enforce it, and then the report types beyond CSP, one at a time, each when your reports say the last step has settled. Your Next Step describes each stage. The setup panel’s block follows the step, so copy it again when the step changes.
6. Already Have a Policy?
Section titled “6. Already Have a Policy?”Choose I’ll use my own policy, and the step shows the lines to add to the policy you already serve, built from your site’s endpoint. One header:
Reporting-Endpoints: headerhawk="https://your-ingest-code.ingest.us.headerhawk.com/r"and, inside your existing Content-Security-Policy or
Content-Security-Policy-Report-Only, two directives:
report-to headerhawk; report-uri https://your-ingest-code.ingest.us.headerhawk.com/rAdd both: Chrome sends to the report-to endpoint, and Firefox and Safari read
only report-uri. If your site already sends a Reporting-Endpoints header,
add headerhawk="…" to it, separated by a comma, rather than sending a second
one. Check my headers looks inside whatever policy your page serves for
both directives. The step waits for your policy’s first report, and from then
on your reports place the site: a report-only policy is asked to be enforced
once its reports are clean, and an enforced one moves straight on to the report
types beyond CSP.
Or start from the starter policy
Section titled “Or start from the starter policy”Every report type and a starter policy are under All report types in the site’s setup panel. The starter policy allows only your own origin:
Reporting-Endpoints: headerhawk="https://your-ingest-code.ingest.us.headerhawk.com/r"Content-Security-Policy-Report-Only: default-src 'self'; report-uri https://your-ingest-code.ingest.us.headerhawk.com/r; report-to headerhawkIts first reports name each third-party script, font and API your pages use.
Add the origins you trust to the policy, and rename the header to
Content-Security-Policy once its reports are clean. Each type’s switch there
asks browsers for exactly the types switched on, script hashes
('report-sha256') included, so copy the block again after changing one.
Browser Report Types describes each type
and the header that requests it.
Next Steps
Section titled “Next Steps”- Understand CSP concepts - Learn how CSP works
- CSP directive reference - Tune your policy
- Troubleshooting - Fix common issues