I have two URLs:
One is the application URL = One is the application API URL = /
How can I get the application to be able to request things from the api at a different subdomain.
I have already tried putting Access-Control-Allow-Origin: * on both sides with no luck.
Thanks
I have two URLs:
One is the application URL = http://domain./app One is the application API URL = http://api.domain./
How can I get the application to be able to request things from the api at a different subdomain.
I have already tried putting Access-Control-Allow-Origin: * on both sides with no luck.
Thanks
Share Improve this question asked Jun 22, 2012 at 17:48 JeffJeff 9432 gold badges10 silver badges17 bronze badges 1- It might help : stackoverflow./a/11072639/705773 – Ajinkya Commented Jun 22, 2012 at 17:50
2 Answers
Reset to default 5The two servers (not the client) need to send the following headers:
- Access-Control-Allow-Origin : Decide which origin could call into the server
- Access-Control-Allow-Methods : The method that is allowed to access the resource (GET or POST)
- Access-Control-Max-Age : How long the cache is held
You could inspect the headers returned from the server (using Firebug or others) if the servers are supporting cross origin resource sharing.
If you can't modify the two servers to add the headers, one other possibility to set up a proxy that sit between your request and two servers. This proxy could add the headers if you need to access them
If you own admin right to the servers, this CORS page shows how to add the headers in various platforms.
set the cookie domain to .domain.
and you should be all set.. This is what I have done in my application..