The right way to edit the worker code is on your local machine before using wrangler to publish it. There should be a file in your project directory like `workers-site/index.js` which is your worker code in easily-editable format.
BTW, this file was copied from a template when you first generated the project. Earlier this year we updated the template to set several security headers:
https://github.com/cloudflare/worker-sites-template/commit/8...
But if you generated your project before that, you probably still have the old code. If you haven't made any changes yourself, you might want to regenerate your project so that it uses the latest template.