I've got two domains:
domain.com sub.domain.com
domain.com needs to make an ajax request to sub.domain.com. I realize that the browser will block this if the request is hardcoded to be sub.domain.com. I tried the following nginx conf:
server {
server_name domain.com;
rewrite ^/api/(.*)$ http://sub.domain.com/api/$1; }
However, I still get the following error in the browser (Chrome):
No 'Access-Control-Allow-Origin' header is present on the requested resource.
How can I set up nginx to instruct the browser to allow cross domain requests between domain.com and sub.domain.com?
Thanks!