Files
outline/server/api/middlewares/subdomainRedirect.js
2016-05-27 00:00:00 -07:00

13 lines
317 B
JavaScript

export default function subdomainRedirect(options) {
return async function subdomainRedirectMiddleware(ctx, next) {
console.log(ctx.headers);
if (ctx.headers['x-forwarded-proto'] != 'https') {
ctx.redirect('https://' + ctx.headers.host + ctx.path);
}
else {
return next();
}
}
};