Hi all,
I am having a problem when trying to use XMLHttpRequest with a proxy
server. The issue is that I want to change the Request-URI from the
header. Here is part of the code:
var url = "http://1.1.1.1:6061";
var host = "2.2.2.2:80";
....
req.open("POST", url, false);
req.setRequestHeader("Host", host);
....
req.send(data);
....
What I want to do is to send this packet to the "url" proxy server,
and have it redirected to the "host" IP and port address. The header
that is being sent is as following:
POST / HTTP/1.1
....
Host: 1.1.1.1
But I want this to be this way:
POST http://2.2.2.2:80/ HTTP/1.1
....
Host: 2.2.2.2
I've tried many ways to do that but with no success:
req.open("POST\x09http://"+host+"/\x09HTTP/1.1", url, false);
req.open("POST\thttp://"+host+"/\tHTTP/1.1", url, false);
req.setRequestHeader("Request-Line","POST http://"+host+"/ HTTP/1.1");
req.setRequestHeader("Method", "POST http://"+host+"/ HTTP/1.1");
Does anyone know a solution to that? If I set my IE proxy to the "url"
address, set the "url" to the "host" address and then initialize the
script then it works, but I don't want to set the proxy.
Thanks,
Rodrigo