Aloento
1
I want to add two headers in response:
Cross-Origin-Embedder-Policy=require-corp
Cross-Origin-Opener-Policy=same-origin
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 => {
event.respondWith(handleRequest(event.request))
})
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")
console.log("hint")
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders
})
}
Can anybody help me to figure out this?
sdayman
2
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?
Aloento
3
I just tried it and found that none of the workers could be triggered and I don’t know why.
Then, I visit https://musi.land, but nothing changed.
The Real-time Logs are also empty.
sdayman
4
It looks like a Cloudflare Pages site. Is this correct?
Aloento
5
Yes, it is hosted by Pages.
All records are Proxied.
sdayman
6
I’ll let @WalshyMVP take it from here, but it’s pretty late in his timezone.
1 Like
Aloento
7
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.