Cloudflare Worker cannot edit response headers of a request to IPFS

Hi there!

I am working on a Worker that simply edits a response by adding “X-Dummy-Header”: “etc”

The code looks like a bit like this

async function handleRequest(request) {
  // Make the headers mutable by re-constructing the Request.
  request = new Request(request); 
  let response = await fetch(request);
  response = new Response(response.body, response);
  response.headers.set("X-Dummy-Header", "Hello world");
  return response;

addEventListener("fetch", (event) => {

This worker is currently active on this route

Which points at an IPFS bucket, if you look closely, the header is not present.

But when I point that domain at a regular origin, the header it is present.

It seems like when I am fetching from IPFS, I cannot change the response header.

Thanks for your time!

Hi @thomasalwyndavis,

The Workers Team are more active on their Discord server, so as you have not received a response here, I would recommend asking on Discord if you haven’t already.

Please do feel free to update the thread here if you get a resolution, to help others who may find this topic.

1 Like