Optimize workers performance with fetch

Hello everyone,

I have a webpage at https://example.com/default/page where a Cloudflare Worker is in operation.
This worker is responsible for conducting an A/B test and serving a different random page from Cloudflare Pages.

export default {
    async fetch(request, env, ctx) {
        let urlToRequest = getRandomUrl([

        let res = await fetch(urlToRequest, {
                cf: {
                    cacheTtl: 60 * 10,
                    cacheEverything: true,

        let newRes = new Response(res.body, {
            headers: res.headers,

        newRes.headers.append("Set-Cookie", cookies.serialize('foo', 'bar', {
            maxAge: 60 * 60 * 24 * 7 * 4, // 4 weeks
            path: '/',

        return newRes;

I have a few questions regarding performance optimization and speed enhancement,
for which I haven’t been able to find answers:

  1. Is there a way to optimize the ‘await fetch’ process?
    I’d like to remove “await” in this scenario,
    but it seems that doing so might prevent me from adding cookies to the response.

  2. Considering that accessing https://example.com/cf-pages-url/variant-{1/2/3} routes to Cloudflare Pages,
    would it potentially be faster to request via the *.pages.dev URL?
    Is there a way I can ensure that both the Cloudflare Worker and Cloudflare Pages operate within the same zone?

  3. In this example, I’m serving a single randomized page
    as an A/B test from https://example.com/cf-pages-url/variant-{1/2/3}.
    If I were to serve one of these pages 50% of the time,
    it appears that it would be much quicker compared to the other two pages.
    We’ve tested this across several thousand users.

I would greatly appreciate any assistance or insights. Thank you in advance!