Worker Header and robot.txt Values

Can anyone look at this.

So i have the robot.txt set in worker as suggested but for some apps when I add the worker and try to browse the URL with the worker enabled. I only get the robot.txt file, but when not enabled I get to the normal page.

With Worker enabled

without worker enabled

`

It looks like you have an extra bracket (second to last line).

Here’s mine:

async function handleRequest(request) {
  const init = {
    headers: {
      'content-type': 'text/plain;charset=UTF-8',
    },
  }
  return new Response(someHTML, init)
}
addEventListener('fetch', event => {
  return event.respondWith(handleRequest(event.request))
})
const someHTML = `
User-agent: *
Disallow:
`

This topic was automatically closed after 30 days. New replies are no longer allowed.