Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE8/9 AJAX/CORS (XDomainRequest) send referer header

I'm using XDomainRequest in IE8 & 9 to send requests to a server. With XMLHttpRequests in other browsers, both an Origin and Referer header are sent, and could look like this:

Origin: http://www.example.com
Referer: http://www.example.com/mypage/index.htm

But XDomainRequest only sends the Origin (so I don't see the full calling URL). Is there a way to force it to also send the Referer? I'm trying to avoid sending it as a query string or POST parameter.

I know that XDomainRequest doesn't allow custom headers, but I'm hoping that because Referer is a standard header there might be some way to enable it.

like image 899
Dave Avatar asked Nov 13 '22 06:11

Dave


1 Answers

One of my co-devs had this problem, that the CORS service they were calling required headers for "security", but IE couldn't send headers. We found no solution to IE8/9 headers problem apart from:

  1. Have the service not require a header
  2. Have a proxy that will append the headers you need onto your request.

Option 2 explained is - Setup a web proxy, that will accept the call without headers. It then makes the CORS call and adds the header onto the request. It receives the payload and forwards it onto your request.

For what it's worth, we went with option 1.

like image 52
dano Avatar answered Nov 15 '22 05:11

dano