exports.handler = async (event) => {
const { uri, querystring } = event?.Records?.[0]?.cf?.request || {};
const url = new URL(uri, `https://genderdysphoria.fyi`);
url.search = new URLSearchParams(querystring);
const body = `
Gender Dysphoria Bible
Redirecting...
Click here if you are not redirected.
`;
return {
status: '301',
statusDescription: `Redirecting to www domain`,
headers: {
location: [{
key: 'Location',
value: url.toString()
}],
},
body
};
};