Websocket worker cannot add response headers

In a websocket worker most clients require security protocol headers.
I am unable to add headers to the response without receiving an error
Error: The script will never generate a response.
I have tried many things, when I try to add security headers on a custom domain
cloudflare returns a error that you cant add or modify headers that start with sec-