Curl request redirects to specific URL

Hi ,

I am trying to implement script on Workers for any requesting from curl command.
They will be redirected to specific URL. The problem is there is an error as my following script below.
Anyone can help to find the mistakes?

addEventListener(​"fetch", event => {

const​ newLocation = ​""​
async​ ​function​ handleRequest(request) {
  ​const reqUA = request.headers.get(​"User-Agent"​)
  ​if​ (reqUA.includes(​"curl")) {
    ​return​ Response.redirect(newLocation, ​302​)
return​ fetch(request)


A post was merged into an existing topic: Detecting curl request to redirect to specific URL