From 5447516b9a87725a6f8c55ec7e4ea1c1be839ee6 Mon Sep 17 00:00:00 2001 From: Austin Heap Date: Thu, 6 Sep 2018 05:23:46 -0700 Subject: draft "security.txt" spec integration (#1020) --- server/controllers/static.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'server/controllers') diff --git a/server/controllers/static.ts b/server/controllers/static.ts index df31c3134..63f78b3b3 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -79,6 +79,21 @@ staticRouter.get('/robots.txt', } ) +// security.txt service +staticRouter.get('/security.txt', + (_, res: express.Response) => { + return res.redirect(301, '/.well-known/security.txt') + } +) + +staticRouter.get('/.well-known/security.txt', + asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.SECURITYTXT)), + (_, res: express.Response) => { + res.type('text/plain') + return res.send(CONFIG.INSTANCE.SECURITYTXT + CONFIG.INSTANCE.SECURITYTXT_CONTACT) + } +) + // nodeinfo service staticRouter.use('/.well-known/nodeinfo', asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO)), -- cgit v1.2.3