525 Error On Worker Fetching External Resource

That’s what I am trying to say , if you put this code -

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://example.com`)
}
function MethodNotAllowed(request) {
  return new Response(`Method ${request.method} not allowed.`, {
    status: 405,
    headers: {
      'Allow': 'GET'
    }
  })
}

In the eg. You are trying to fetch data from example.com which is quite possible since it’s not a protected website, but to access other website resources you need permission or you need to find out their project host details which is impossible to find out since companies don’t share these details with any 3rd person. But if you still try to fetch the address then i will return a 502 error.