Could not find host

Hello All,

Not sure if you could give me a bit of a hand with this one, on a test wordpress site i have made I’m getting the following error when ever i got to anything other than the route of the domain. Example of the error seen here.

Many thanks

Are you having a Worker script in place?

Look at the error message (blog.incentec.orgwp-includes). You seem to concatenate or process the request string incorrectly.

Hey @sandro,

There is a worker script yes, even when the route is disabled there is an issue. The only way for the issue to stop atm is not to proxy it through Cloudflare.

The script is the following
addEventListener(‘fetch’, event => {

async function handleRequest(request) {
let url = new URL(request.url)
// Checking if /blog pattern is part of the URL
if (url.pathname.match(/^/blog(.)/)) {
// Instantiate an URL object so I can play with it later
newUrl = new URL(request.url)
// match() function sends back an array with all matches and because my regex as a capturing group, the [1] will be that exact value, so what’s after /blog actually and I’m using it to set thee new path
newUrl.pathname = url.pathname.match(/^/blog(.
// constructing a new request with this URL and shifting traffic to a new host that will receive the request but without /blog in the path, eveything else will be kept (searchParams and all)
return await fetch(newUrl, {request, cf: {resolveOverride: “”}})
return await fetch(request)

Many thanks

How many scripts do you have mapped? Can you disable them all and check? Also, how long did you wait? It can take some time until the script is not executed any more.

Also also, you need to post the code again, this time properly formatted. The current code is not valid JavaScript.

Anyhow though, you should debug your code, something is off and skews the actual hostname.

Also also also, resolveOverride takes a hostname, you seem to have specified somewhat of a URL.

Also also also also, if you just want to remove /blog, using url.pathname.replace(/^\/blog/, '') is probably more efficient than all the matching.

But again, somewhere in your code you make that hostname invalid and that’s what you need to debug.

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