Enabling CORS on Apache Tomcat 6

Copy cors-filter-<version>.jar file and java-property-utils-<version>.jar to $CATALINA_HOME/lib. Then, edit the $CATALINA_HOME/conf/web.xml file to include: <filter> <filter-name>CORS</filter-name> <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class> </filter> <filter-mapping> <filter-name>CORS</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> It’s important to note that simply using the above configuration options in web.xml will enable public CORS access to the server. You may want to limit the cors.allowOrigin …

Cross Domain Request Workarounds (Updated)

When trying to access your data tier, you [may] encounter the browser’s built in security feature that does not allow you to make XMLHttpRequest object requests to a different domain (see Same Origin Policy). UPDATE 10-24-2012: To get CORS working in IE8 and IE9, use XDomainRequest using the object’s onload …