Wednesday, July 8, 2015

Enable CORS WSO2 Data services server

This post is about how to enable CORS in Wso2 Data Services server.

I'll explain in point form as it will be easy for readers to understand and test the scenario. (I have tested this in DSS 3.2.2 version)

1) downloaded "cors-filter-2.4.jar" and "java-property-utils-1.9.1.jar" from the site [1] and added those jars to DSS/repository/components/lib folder

2) added below config elements to DSS/repository/conf/tomcat/web.xml file
   
  CORS
  com.thetransactioncompany.cors.CORSFilter  
 


        CORS
        /*

3) restarted the DSS and then CORS will work fine now

PS - you can fine tune url pattern to allow this to limited url patterns. for example you can use pattern as below
/services/*
using this you can fine tune it to allow CORS for only some of the services hosted in DSS

[1] - http://software.dzhuvinov.com/cors-filter-installation.html

Hope this helps :-)