Subdomain redirecting

This commit is contained in:
Jori Lallo
2016-05-27 00:06:36 -07:00
parent eab41436a6
commit a0f86f5ed4
3 changed files with 6 additions and 4 deletions

View File

@@ -0,0 +1,12 @@
export default function subdomainRedirect(options) {
return async function subdomainRedirectMiddleware(ctx, next) {
console.log(ctx.headers);
if (ctx.headers.host === 'beautifulatlas.com') {
ctx.redirect('https://wwww.' + ctx.headers.host + ctx.path);
}
else {
return next();
}
}
};