Redirect Traffic


Hi, We are trying to set up the following traffic pattern:
-all requests for{/}* are sent to the existing A record
-all requests for{/path} are sent to{path}

I’ve written the following code. The blog loads correctly, but the Webflow site does not. What is wrong?

addEventListener(‘fetch’, event => {
async function fetchBlog(request) {
const reqUrl = new URL(request.url)
if (reqUrl.pathname.startsWith(’/blog’)) {
// Return response unmodified.
return fetch(reqUrl, request)
} else {
let newUrl = new URL(‘’)
newUrl.pathname = reqUrl.pathname

	return fetch(newUrl, { 
		method: request.method, 
	headers: request.headers 
	//return fetch (newUrl, request)