This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the companion code for the linked blog | |
// https://blog.kmonsoor.com/on-edge-shortlink-server-cloudflare-kv-worker | |
// Please check the blog to get the context | |
// author : Khaled Monsoor (@kmonsoor) | |
// last updated: 25-May-2021 | |
const failsafeURL = "https://kmonsoor.com" // replace it with yours ;) | |
const defaultStatusCode = 301 // standard HTTP code for redirection, don't change | |
addEventListener("fetch", (event) => { |
OlderNewer