[skip-ci] update redirect checks

This commit is contained in:
deityhub
2021-11-30 12:01:15 +01:00
parent 78d2b7935d
commit 8d28a124b7

View File

@@ -155,35 +155,23 @@ async function handleCertificate(client, collection, domain) {
return certificate;
}
app.use('/', async function(req, res, next) {
app.use(async function(req, res, next) {
const host = req.hostname;
const completeUrl = `https://${host}${req.url}`;
try {
if (host && host === 'fyipe.com') {
if (host && completeUrl === 'https://fyipe.com/') {
res.writeHead(301, {
Location: `https://oneuptime.com?redirectedFromOldBranding=true`,
});
return res.end();
}
if (host && host === 'staging.fyipe.com') {
if (host && completeUrl === 'https://staging.fyipe.com/') {
res.writeHead(301, {
Location: `https://staging.oneuptime.com?redirectedFromOldBranding=true`,
});
return res.end();
}
return next();
} catch (error) {
// eslint-disable-next-line no-console
console.log('Status Page: Error with fetch', error);
return next();
}
});
app.use(async function(req, res, next) {
const host = req.hostname;
try {
if (host && host === 'fyipe.com') {
res.writeHead(301, {
Location: `https://oneuptime.com${req.url}`,
@@ -205,6 +193,31 @@ app.use(async function(req, res, next) {
}
});
// app.use(async function(req, res, next) {
// const host = req.hostname;
// try {
// if (host && host === 'fyipe.com') {
// res.writeHead(301, {
// Location: `https://oneuptime.com${req.url}`,
// });
// return res.end();
// }
// if (host && host === 'staging.fyipe.com') {
// res.writeHead(301, {
// Location: `https://staging.oneuptime.com${req.url}`,
// });
// return res.end();
// }
// return next();
// } catch (error) {
// // eslint-disable-next-line no-console
// console.log('Status Page: Error with fetch', error);
// return next();
// }
// });
app.use('/', async function(req, res, next) {
const host = req.hostname;
if (