Configure JS devServer with custom headers

I’m building a web frontend for my multiplatform project, and as part of that I need to use the JS SharedArrayBuffer. When using this class in JS, you must have two specific headers set. If not, this class is not available.

How can I enable these headers when running the devServer? I have managed to configure a lot of things on it (such as static resource directories), most of this using configuration options that appear to be completely undocumented.

However, I have been unable to figure out how to configure the headers. Is this documented anywhere?