This worked perfectly. Thank you for the quick reply. Here’s the gist to block anyone in the United States or Cuba:
export default async function geoBlock(req, { geo }) {
if (
geo.country.code !== 'US' ||
geo.country.code !== 'CU'
) {
return;
}
const html = `
<!DOCTYPE html>
<html lang="en">
<body>
Sorry, we are unavailable in ${geo.country.name}
</body>
</html>
`;
return new Response(html, {
headers: { 'content-type': 'text/html' },
});
}