Demo
Here is a live demo of the activiti created using AngularJs
http://activiti.alfrescoblog.com/?o=b
Introduction
In the previous post about angular.js and activiti-rest application we have shown how to list users, groups and login. Recently we have decided to fork activiti-webapp-angular and add all of the features from part I in it. Hopefully that this will be real activiti angular.js version.
One of the problems that we had was how to use gruntjs and angular.js factory with activiti-rest without Access-Control-Allow-Origin problem.
In this post we are going to explain how to use gruntjs and angular.js and be able make cross domain http requests without worrying about Access-Control-Allow-Origin.
Solution Explanation
In our case we have
- Tomcat that runs on port 8080
- gruntjs that runs on port 9000
- Apache that runs on port 80
To solve our problem we are going to setup proxy on Apache server that will :
- proxy path localhost/ -> localhost:9000/
- proxy path localhost/service -> http://localhost:8080/activiti-rest/service/
This way angular.js application is communicating with itself and there is no access-control problem :).
Solution Technical
After installing Apache add next modules
- LoadModule proxy_module modules/mod_proxy.so
- LoadModule proxy_http_module modules/mod_proxy_http.so
in httpd.config add
ProxyPass /service/ http://localhost:8080/activiti-rest/service/ retry=0 timeout=30 ProxyPass / http://localhost:9000/ retry=0 timeout=30
How to use
Access your application on localhost/ , or if you have any other configuration add your Apache url.
You can read the post about activiti and angular.js here.
The simplest ideas are the best! I’ll be using this, cheers!
Thank you Ben!