I have one curl command which is responding ok. But same thing when I am trying in java script, it is not giving success.
Curl command that I am running in dos:
curl "http://serverip/live/test01/test01_mcs.isml/playlist_high.mpd" -H "Host:actualServer.net" -i
This returns a play url.
Same thing I am trying to mimic in JavaScript as
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "http://serverip/live/test01/test01_mcs.isml/playlist_high.mpd", true);
xhttp.setRequestHeader("Host", "actualServer.net");
xhttp.setRequestHeader("Access-Control-Allow-Origin", "*");
xhttp.send();
This gives error as "Refused to set unsafe header Host"
I tried http get
also, but same response.
I tried in Java's AsynHttpClient using asyncHttpClient.post(url,new ResponseHandler());
.
I tried Java's AsynHttpCLient using asyncHttpClient.post(mContext, url, entity, contentType, new ResponseHandler())
also. In this I tried passing my host in entity, but no luck.
I am out of options now. Any help or suggestions are much appreciated.