mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
Update redirect
This commit is contained in:
parent
86e0ba90e1
commit
4ddca4d5a4
2 changed files with 18 additions and 0 deletions
8
docs/v1/netlify.toml
Normal file
8
docs/v1/netlify.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[[edge_functions]]
|
||||
path = "/"
|
||||
function = "redirect"
|
||||
|
||||
[[redirects]]
|
||||
from = "/*"
|
||||
to = "/index.html"
|
||||
status = 200
|
||||
10
docs/v1/netlify/edge-functions/redirect.js
Normal file
10
docs/v1/netlify/edge-functions/redirect.js
Normal 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));
|
||||
}
|
||||
Loading…
Reference in a new issue