Can cloudflare domain workers have free SSL ?

Ive made a worker with following index.js

addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request));
  });
  
  async function handleRequest(request) {
    const response = new Response('helloWorld', {
      headers: {
        'Content-Type': 'text/plain',
        'Access-Control-Allow-Origin': '*', // Replace with your allowed origins
        'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', // Allow the necessary methods
      },
    });
    return response;
  }


but I couldn't fetch it from a serverless front end html like
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Cloudflare API Request</title>
</head>
<body>
  <button id="fetchButton">Fetch Data</button>
  <p id="responseText"></p>
  <script>
    const fetchButton = document.getElementById('fetchButton');
    const responseText = document.getElementById('responseText');
    
    fetchButton.addEventListener('click', async () => {
      try {
        const response = await fetch('https://hyperbeam.nithinsteven32.workers.dev/');
        if (!response.ok) {
          throw new Error('Network response was not ok');
        }
        const data = await response.text();
        responseText.textContent = data;
      } catch (error) {
        console.error('Error fetching data:', error);
        responseText.textContent = 'Error fetching data';
      }
    });
  </script>
</body>
</html>


when i tried

https://checkforcloudflare.selesti.com/?q=https://hyperbeam.nithinsteven32.workers.dev/

I learned ssl was not setup on the url
maybe that's the issue ?

Any help appreciated 😊
Check for Cloudflare
Quickly and easily check to see if your or any other domain is using Cloudflare!
Was this page helpful?