diff --git a/cloudflare/worker.js b/cloudflare/worker.js index 8c5816e68d..4147241994 100644 --- a/cloudflare/worker.js +++ b/cloudflare/worker.js @@ -272,10 +272,8 @@ export default { }); newHeaders.set('host', targetUrl.host); newHeaders.set('origin', BING_ORIGIN); - if (request.headers.has('referer')) { - if (request.headers.get('referer').indexOf('web/compose.html') != -1) { - newHeaders.set('referer', 'https://edgeservices.bing.com/edgesvc/compose'); - } + if (request.headers.has('referer') && request.headers.get('referer').indexOf('web/compose.html') != -1) { + newHeaders.set('referer', 'https://edgeservices.bing.com/edgesvc/compose'); } else { newHeaders.set('referer', 'https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx'); }