Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to allow cross domain requests on tomcat?

I am deploying a web app on 2 separate domains, the first web app is a restful service deployed on tomcat 6, the second is a static content (html, java script), the java script from the static content domain will call the restful service. but the same origin policy is not allowing this, my question is: how to allow cross domain requests on tomcat?

like image 261
Ahmad Musa Avatar asked Oct 24 '22 02:10

Ahmad Musa


1 Answers

If you're able to focus on modern browsers, I suggest looking into a Java implementation of Cross Origin Resource Sharing, or CORS, perhaps like this one.

Mozilla introduced CORS in FF3.5 and it's since become pretty widely adopted. IE introduced a competing, stricter standard XDomainRequest called that doesn't leak cookie information, but only IE supports it.

IE is slated to support CORS in IE 10, which makes it the technique of choice.

like image 198
buley Avatar answered Oct 27 '22 09:10

buley