Add http:// to target if it is not exist

This commit is contained in:
2020-04-03 23:23:33 +08:00
parent dfc961a7e7
commit ecaefb85bd

View File

@ -8,7 +8,15 @@ const app = express();
app.use(morgan('common'))
app.get('/*', async (req, res) => {
const target = req.url.slice(1);
const rawTarget = req.url.slice(1);
let target: string;
if (!rawTarget.includes('://')) {
target = 'http://' + rawTarget;
}
else {
target = rawTarget;
}
const location = await getLocationOfTarget(target);
if (location) {