Skip to main content
Home

latest
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
52%
Published
2 years ago (1.1.0)

Report To

npm version dependencies Status Actions Status Coverage Status FOSSA Status

This is Express middleware to set the Report-To HTTP response header. You can read more about it here and here.

To use:

const reportTo = require('report-to')

// ...

app.use(reportTo({
  groups: [
    {
      group: "endpoint-1",
      max_age: 10_886_400,
      include_subdomains: true,
      endpoints: [
        {
          url: "https://example.com/reports",
          priority: 1
        },
        {
          url: "https://backup.com/reports",
          priority: 2
        }
      ]
    }
  ]
}))

When set alone, this header doesn't do anything and will need to be set with a header that allows reporting, such as Content-Security-Policy, NEL, etc.

For example, using the above definition, a NEL header may look like the following, using endpoint-1 as its report-to parameter: NEL: {"report_to":"endpoint-1","max_age":31536000,"include_subdomains":true} You can use this module to set an NEL header easily with express.

https://report-uri.com/ is a great reporting platform for monitoring CSP, NEL, etc. error logs.

License

FOSSA Status

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@james/report-to

Import symbol

import * as report_to from "@james/report-to";
or

Import directly with a jsr specifier

import * as report_to from "jsr:@james/report-to";

Add Package

pnpm i jsr:@james/report-to
or (using pnpm 10.8 or older)
pnpm dlx jsr add @james/report-to

Import symbol

import * as report_to from "@james/report-to";

Add Package

yarn add jsr:@james/report-to
or (using Yarn 4.8 or older)
yarn dlx jsr add @james/report-to

Import symbol

import * as report_to from "@james/report-to";

Add Package

vlt install jsr:@james/report-to

Import symbol

import * as report_to from "@james/report-to";

Add Package

npx jsr add @james/report-to

Import symbol

import * as report_to from "@james/report-to";

Add Package

bunx jsr add @james/report-to

Import symbol

import * as report_to from "@james/report-to";