Workers with HTMLRewrite not working with

My website works completely fine, and I am loading under 1s, I have score of 60-80/100 depending on the page. But when Instead of returning this:

    response.headers.set("X-XSS-Protection", "1; mode=block");
    response.headers.set("X-Content-Type-Options", "nosniff");
    response.headers.set("X-Frame-Options", "DENY");
    response.headers.set("Referrer-Policy", "unsafe-url");
    response.headers.set("Feature-Policy", "none");

    return response;

I return this:

const rewriter = await getHeadRewriter("en");
return rewriter.transform(response)

The website dont load on PageSpeed Insights or But the website works on the browser and even on the LIghtHouse extension, just not on these sites.

The reweriter only displays a Hello World.

I am thinking maybe “transform” updates the Headers or soemthing. I can’t see for example content-length, and this might be the issue, because I remove the rewriter.transform(response) and works again