Altering Response Headers via Workers

Dear Fellow Community Members,

We trying to alter (Set & Delete) Response Headers by using Workers.

However, all the Code Templates / Snippets that we are getting seams to be not working on Response Headers.

At the max we see that only Request Headers can be altered / added…not the response.

Couple of such example is :

Please guide or let us know what is the way out.

Appreciate a bit detailed / explainatory support or a sample code.

Thanks in advance.

Stay Safe.