strapi-ts
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite
31 lines (25 loc) • 484 B
JavaScript
;
/**
* Module dependencies
*/
const convert = require('koa-convert');
const { hsts } = require('koa-lusca');
/**
* HSTS hook
*/
module.exports = strapi => {
return {
/**
* Initialize the hook
*/
initialize() {
strapi.app.use(async (ctx, next) => {
if (ctx.request.admin) return next();
return await convert(hsts(strapi.config.middleware.settings.hsts))(
ctx,
next
);
});
},
};
};