cancel
Showing results for 
Search instead for 
Did you mean: 

REST serverless application?

tstephen
Champ on-the-rise
Champ on-the-rise
Hi all,

Just wondering if anyone, like me, is trying to access the REST API from a browser application (i.e. making AJAX calls)? It would seem this will only work if I put my app in the activiti-rest webapp due to the old cross-origin scripting problem but I wanted to check that I have not missed something.

Cheers,
Tim
2 REPLIES 2

trademak
Star Contributor
Star Contributor
Hi Tim,

We do this as well from a JavaScript application. One way to solve it is using the same application as the REST application or create a proxy.
We also have JSONP support in the REST API by default, so that's a possibility as well.

Best regards,

jbarrez
Star Contributor
Star Contributor
Yes indeed.

We typically use an Apache proxy that acts as a proxy for the rest. For the UI, it looks as it is doing requests to its own server.

Ie, the apache is running on 8080. The UI on 9688, the rest on 9000. Interaction with the ui is done through 8080 urls/

here's our config (httpd.conf)

#ServerRoot "apache"
ServerName  "activiti-proxy"
Listen   8888
PidFile  "var/run/apache/http.pid"
LockFile  "var/lock/apache/accept"

# ———————————————————–
# Proxy (see http://www.apachetutor.org/admin/reverseproxies)
# ———————————————————–

LoadModule  proxy_module         ${APACHE_MODULES_DIR}/mod_proxy.so
LoadModule  proxy_http_module    ${APACHE_MODULES_DIR}/mod_proxy_http.so


ProxyPass       /service/   http://localhost:9000/          retry=0 timeout=30

ProxyPass       /           http://localhost:9688/          retry=0 timeout=30