Does anyone know how to add or create a custom HTTP header using JavaScript or jQuery?
You should avoid the usage of $.ajaxSetup() as described in the docs. Use the following instead:
$.ajaxSetup()
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) { jqXHR.setRequestHeader('my-custom-header', 'my-value'); });