Skip to Content
Author's profile photo Former Member

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.



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Anthony MULLER
      Anthony MULLER

      Hi Rogerio!

      Thanks for this post!

      Maybe this document could help too:



      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Anthony,

      The advantage of this approach is that it can be used at client side, so the user can do it without having to access the CMS.