2 years ago
#68393

Abdullah
Respond with another site NOT Working on Cloudflare Workers
It's working for example .com BUT not working for my desired domain.
Can you please help me to figure out ?
addEventListener('fetch', function(event) {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
// Only GET requests work with this proxy.
if (request.method !== 'GET') return MethodNotAllowed(request)
return fetch(`https://reveal.magic.link/awst-test`)
}
function MethodNotAllowed(request) {
return new Response(`Method ${request.method} not allowed.`, {
status: 405,
headers: {
'Allow': 'GET'
}
})
}
cloudflare
cloudflare-workers
0 Answers
Your Answer