0

I send request to my API with ajax in NodeJS as shown as:

$.ajax({
        url: myurl,
        method: 'GET',headers:{'Referer':MyWebsiteName}
        xhr: function() {
            return xhrOverride;
        })

But NodeJS dont send my headers and show Refused to set unsafe header "Referer" , I send this request with python and work perfect, How can I disable this Refused to set unsafe header "Referer" in NodeJS?

henrry
  • 486
  • 6
  • 25

1 Answers1

0

thanks from user @robertklep for his solution.

We just after var xhr = new XMLHttpRequest(); set xhr.setDisableHeaderCheck(true); as shown as:

var xhr = new XMLHttpRequest();
xhr.setDisableHeaderCheck(true);


$.ajax({
        url: myurl,
        method: 'GET',headers:{'Referer':MyWebsiteName}
        xhr: function() {
            return xhrOverride;
        })
henrry
  • 486
  • 6
  • 25