Problem statement is described in this blog post.
- Install Wrangler.
- Authenticate with your Cloudflare account using
wrangler login. - Update
wrangler.tomlwith your event name and webhook key. - (Optional) Include allowed origins in the whitelist by updating the
index.tsfile. Add regular expressions for desired origins to thewhitelistarray using the format:const whitelist: RegExp[] = [/origin1.com/, /.*\.example\.com/]; - Deploy the worker using
wrangler deploy.
fetch("https://cors-proxy.workers.dev/?apiUrl=https://api.ipify.org?format=json").then(response => {
return response.json();
}).then(data => {
console.log(data);
});where https://api.ipify.org?format=json is the URL you want to fetch and https://cors-proxy.workers.dev is the URL of your deployed worker.