Trying to set up a worker for server side GA4 with Stape

For Workers & Pages, what is the name of the domain?

What is the issue or error you’re encountering

I’m setting up GA4 server side with Stape. The DNS settings work, but I want to use “same origin” for the cookie. I set up a worker and worker routing accoring to their documentation, but it doesn’t seem to work

What steps have you taken to resolve the issue?

I set up this worker:
export default {
async fetch(request, env, ctx) {
let {pathname, search, host} = new URL(request.url);
pathname = pathname.replace(‘/metrics/’, ‘/’);
const domain = ‘sgtm.stape.video’;
let newRequest = new Request((https:// + domain + pathname + search), request);
newRequest.headers.set(‘Host’, domain);
return fetch(newRequest);
},
};

I have also set up a route for this worker

When I go to the test page tryomni1.com/s/healthy it should return the text “OK” if it works, however I only get a 404 page. The NameBright - Coming Soon test returns an “OK” so that works.

Any idea what I might be missing? Thanks in advance for any help!