Ajax cross domain on same machine but different port

ajax, cross-domain, javascript, jquery

Solution

Two or more documents can be considered in same domain origin, if they have on - Same Host - Same Port - Same Protocol. In your case port is different so you can not put ajax query directly. Instead you need to specify following header in response.

 Access-Control-Allow-Origin: mycompany.com 

For more info, check this

Problem

We have a set of api that we're calling from the same machine, the address is `mycompany.com:8080` for the server and `mycompany.com` for the ajax.html file. How can we avoid the cross domain policy? Anyway to do this with some proxy configuration? please, no JSONP! Thanks!

Original source

Related problems