Transform rules not work for add header [Solved]

I want to add two headers in response:

But I tried a lot of times, it’s still not working.

Then I try to use Workers, but still not working.

addEventListener('fetch', event => {

async function handleRequest(request) {
  let response = await fetch(request)
  let newHeaders = new Headers(response.headers)
  newHeaders.set("Cross-Origin-Embedder-Policy", "require-corp")
  newHeaders.set("Cross-Origin-Opener-Policy", "same-origin")
  newHeaders.set("X-Frame-Options", "SAMEORIGIN")

  return new Response(response.body, {
    status: response.status,
    statusText: response.statusText,
    headers: newHeaders

Can anybody help me to figure out this?

Without knowing the actual domain, there’s not much we can suggest, other than it’s probably not proxied through your account.

Do any workers function for you?

I just tried it and found that none of the workers could be triggered and I don’t know why.

Then, I visit, but nothing changed.
The Real-time Logs are also empty.

It looks like a Cloudflare Pages site. Is this correct?

Yes, it is hosted by Pages.
All records are Proxied.

I’ll let @WalshyMVP take it from here, but it’s pretty late in his timezone.

1 Like

I tried with another domain that is hosted by GitHub Pages and transform works fine…
So now I’m so confused…

But now I know what happened.
I add a lot of A records for cf pages, after I remove them, then works fine.