From 88c5fc6ccebc88fdc8e7c0248b63d8542362e866 Mon Sep 17 00:00:00 2001 From: Luke Prior <22492406+LukePrior@users.noreply.github.com> Date: Sun, 12 Dec 2021 22:10:31 +1100 Subject: [PATCH] Redirect for site --- redirect/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/redirect/index.js b/redirect/index.js index 39995d3..d4264b9 100644 --- a/redirect/index.js +++ b/redirect/index.js @@ -20,6 +20,21 @@ exports.handler = (event, context, callback) => { callback(null, specific_response); return; } + if (request.uri.startsWith('/site/')) { + var site = request.uri.replace(/^\/site\//, ""); + var specific_response = { + status: '302', + statusDescription: 'Found', + headers: { + location: [{ + key: 'Location', + value: 'https://sondehub.org/#!site=' + site + }], + }, + }; + callback(null, specific_response); + return; + } if (request.uri.startsWith('/go/')) { var name = request.uri.replace(/^\/go\//, ""); if (name == "donate") {