16 lines
348 B
JavaScript
16 lines
348 B
JavaScript
// @flow
|
|
import type { Context } from "koa";
|
|
|
|
export default function apexRedirect() {
|
|
return async function apexRedirectMiddleware(
|
|
ctx: Context,
|
|
next: () => Promise<*>
|
|
) {
|
|
if (ctx.headers.host === "getoutline.com") {
|
|
ctx.redirect(`https://www.${ctx.headers.host}${ctx.path}`);
|
|
} else {
|
|
return next();
|
|
}
|
|
};
|
|
}
|