Update: crossdomain direct HTTP calls (POST) to Tersus server implemented.
This update is only for HTML5, however Cross-Origin Resource Sharing (CORS) is not fully implemented yet accross different browsers (Firefox and Safari seems to work).
In order to get crossdomain calls working, you first need to setup your server. Setup will be explained for Tersus Studio, since my goal is easy understandable proxy or server usage for novices.
First download CORS filter here:http://software.dzhuvinov.com/download.html#download-cors
Go to directory where your Tersus Studio is installed and then continue to plugins/tersus.appserver_<your version>/DefaultWebapp/WEB-INF
Now create directory named lib and copy inside cors-filter-1.2.jar from downloaded archive. Then, edit web.xml inside WEB-INF direcotory by adding follwing section right after </session-config>
<filter> <filter-name>CORS</filter-name> <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class> <init-param> <param-name>cors.allowOrigin</param-name> <param-value>*</param-value> </init-param></filter><filter-mapping> <filter-name>CORS</filter-name> <url-pattern>/*</url-pattern></filter-mapping>
If you start/restart your application now (without restarting Studio), your application will become crossdomain, Cross-Origin Resource Sharing ready.
If you want to use Tersus PHP proxy now only for HTTP GET requests, leaving POST requests going directly from client to your server, you can (re)configure proxy using parameter:
[cache] - except clear or remove (standalone, lowercase) commands, you can now use POST (default) or GET (optional, uppercase) values. GET instructs proxy to cache and operate only GET requests, while POST will cause all requests to pass proxy . Don't forget to clear cache first if you want to change values between GET and POST.
So, how this works? When application is loaded via proxy, web browser will try to send POST reqeust to your server trying to break Same Origin Policy using request header:
and if CORSE is installed and configured, your server will respond:
Access-Control-Allow-Origin: http://flash.g0dsoft.comAccess-Control-Allow-Credentials: true
That's it, next planed is
- Cirrus, peer assisted networking for developing real-time collaboration applications in your Tersus application
For best results, use the Firefox browser..