Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://xxx.xxxx.com/rest/mobile/api/static/home.html. This can be fixed by moving the resource to the same domain or enabling CORS.
Above is the error I get if I run a mobile app generated via the mobile app development in our Private Cloud (the same one as what the call is made to) but if I host the mobile app files on a different domain. Makes sense this could be an issue but I see the CORS configuration in the private clouds REST web.xml:
Also I have put the following in the private cloud's Tomcat web.xml:
<filter> <filter-name>CorsFilter</filter-name> <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> </filter> <filter-mapping> <filter-name>CorsFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Still getting the CORS error, any suggestions on what's missing?
In Rollbase Private cloud instance, If the mobile app files are hosted in a different domain then you need to add the CORS regluar expression in shared.properties
RBMobile_CORS.Allow_origin.HOST = %RBMobileCORSOriginRegx%
RBMobileCORSOriginRegx value should be a regular expression that matches the Origin of the header of the request.
Example: If the Mobile app is hosted on abc.test.com domain, then RBMobileCORSOriginRegx should be like .*test\\.abc\\.com$
Hope this helps you.