mirror of
https://github.com/strapi/strapi.git
synced 2025-07-12 11:31:38 +00:00
46 lines
680 B
JavaScript
46 lines
680 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Module dependencies
|
|
*/
|
|
|
|
// Public node modules.
|
|
const _ = require('lodash');
|
|
|
|
/**
|
|
* SSL hook
|
|
*/
|
|
|
|
module.exports = function (strapi) {
|
|
const hook = {
|
|
|
|
/**
|
|
* Default options
|
|
*/
|
|
|
|
defaults: {
|
|
ssl: {
|
|
disabled: true,
|
|
trustProxy: false
|
|
}
|
|
},
|
|
|
|
/**
|
|
* Initialize the hook
|
|
*/
|
|
|
|
initialize: function (cb) {
|
|
if (_.isPlainObject(strapi.config.ssl) && !_.isEmpty(strapi.config.ssl)) {
|
|
strapi.app.use(strapi.middlewares.ssl({
|
|
disabled: strapi.config.ssl.disabled,
|
|
trustProxy: strapi.config.ssl.trustProxy
|
|
}));
|
|
}
|
|
|
|
cb();
|
|
}
|
|
};
|
|
|
|
return hook;
|
|
};
|