I know I can add headers to all jQuery AJAX requests, as explained here: How can I add a custom HTTP header to ajax request with js or jQuery?
And here: Add custom http header to all jQuery AJAX Requests
I have a lot of code that was written without jQuery and am wondering if there is a way to add headers automatically to all non-jQuery ajax requests on a server, without needing to edit/modify each request code individually with something like xmlhttp.setRequestHeader("Header-name", "Header-value");