Update redirect

This commit is contained in:
Nicholas Jitkoff 2022-05-28 18:35:35 -07:00
parent 86e0ba90e1
commit 4ddca4d5a4
2 changed files with 18 additions and 0 deletions

8
docs/v1/netlify.toml Normal file
View file

@ -0,0 +1,8 @@
[[edge_functions]]
path = "/"
function = "redirect"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200

View file

@ -0,0 +1,10 @@
export default async (req, context) => {
const ua = req.headers.get('user-agent');
if (ua.toLowerCase().includes('dlesschr')) {
return new Response('', {
status: 401
});
}
context.log("request", ua);
context.log(req.headers, req.headers.get("user-agent"), req.headers.get("referer"), JSON.stringify(context.geo));
}