javascript - Stuck in infinite redirect loop when http get an chunked response -


i'm trying body of following url https://extranet.ores.be/de/services/price-simulation using npm module request. thing , link, module doesn't work think. because continuously fail maxredirects reached error. have debuged think , yes because first call url response location header same url, infite loop. think , redirection doesn't seems problem firefox or chrome, ... browsers resolving correctly. missing ? or maybe proxy problem ?

here parts of code :

var proxiedrequest = request.defaults({proxy: "http://proxy.xxx.xxxxxxx.be:xxxx", maxredirects : 5})     proxiedrequest.get(that.buildrequest(url.url), (error, response, body) => {         let html = null;         let status = null;         let failed = false;          if (!error && response.statuscode === 200 && (response.headers['content-type'].includes('text/html') || response.headers['content-type'].includes('application/xhtml+xml'))){             html = body;         } else if(!error && response.statuscode != 200) {             status = response.statuscode;             failed = true;         }else if(error) {             failed = true;         }          that.emit('getfinished', { html : html, status : status, error : error, failed : failed, url : url } );     }) 

the buildrequest methode :

this.buildrequest = function(url){         return {             url: url.href,             headers: {                 'user-agent': 'mozilla/5.0 (windows nt 6.1; wow64; rv:54.0) gecko/20100101 firefox/54.0',                 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',                 'connection' : 'keep-alive',                 'accept-encoding': this.selectacceptencodingheader(url.protocol)             },             gzip: true,             deflate: true         }     }.bind(this);  this.selectacceptencodingheader = function(protocol){         if(protocol === 'https:'){             return 'gzip, deflate, br';          }          return 'gzip, deflate';     }.bind(this); 

i tried use multipart it's request, not response.

any ideas ? advance

the browsers handle given url correctly because cookies enabled default unlike module request node.

try proxied request:

var proxiedrequest = request.defaults({     proxy: "http://proxy.xxx.xxxxxxx.be:xxxx",     maxredirects : 5,     jar: true // enable cookie }); 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -