Skip to content

Instantly share code, notes, and snippets.

@louisbarclay
Created December 15, 2023 14:15
Show Gist options
  • Save louisbarclay/9176634b590626be085507561c246b1b to your computer and use it in GitHub Desktop.
Save louisbarclay/9176634b590626be085507561c246b1b to your computer and use it in GitHub Desktop.
Circumvent X Substack throttling
export default {
async fetch(request) {
// Get the URL
const url = new URL(request.url);
// url.pathname will be our pathname to use in the HTML doc
// Change this to whatever your Substack subdomain is:
const subdomain = "12challenges";
const html = `<!DOCTYPE html>
<head>
<script>
const stringArray = ["s","u","b","s","t","a","c","k"];
window.location = "https://" + "${subdomain}" + "." + stringArray.join("") + ".com" + "${url.pathname}"
</script>
</head>
<body>
</body>`;
return new Response(html, {
headers: {
"content-type": "text/html;charset=UTF-8",
},
});
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment