Skip to Content

How to make a cross domain HttpRequest to the Restful API in Javascript

Hi All,

I would like to share a way to overcome Cross Domain security issue.

It happens when you are making a HTTP Request from a WEB Server, let’s say, SERVER 1, to a WEB Service hosted in SERVER 2.

To avoid the security issue, add a Request Header to your HTTP Request object:

httpRequest.setRequestHeader('X-PINGARUNER', 'pingpong');

This will allow you to do Cross Domain calls.



You must be Logged on to comment or reply to a post.