Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions server/routes/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { log } from '../log';

const router = Router();

router.get('/csp-audit-report-endpoint', (req: Request, res: Response) => {
log.info(`CSP_AUDIT: ${req.body}`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes cloudwatch is a bit irritating and splits multi line log statements across more than one log line. It does have smarts to spot json, but if we hit this problem, we can always indent subsequent lines (which should help)

res.status(204).send();
});

router.get(
'/_healthcheck',
/**
Expand Down
10 changes: 10 additions & 0 deletions server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ if (conf.DOMAIN === 'thegulocal.com') {

server.use(helmet());

server.use(function (_: Request, res: Response, next: NextFunction) {
res.set({
'Report-To':
'{ "group": "csp-endpoint", "endpoints": [ { "url": "/csp-audit-report-endpoint" } ] }',
'Content-Security-Policy-Report-Only':
'report-uri /csp-audit-report-endpoint; report-to csp-endpoint; default-src https:',
});
next();
});

const serveStaticAssets: RequestHandler = express.static(__dirname + '/static');

/** static asses are cached by fastly */
Expand Down