CORS and Camunda REST

4,355 views
Skip to first unread message

Eldar Aliyev

unread,
Dec 27, 2013, 7:34:06 AM12/27/13
to camunda-...@googlegroups.com
How to turn on Cross-Origin Resource Sharing (CORS) response headers to Camunda REST engine in default distribution packet (with tomcat 7.0) to be able to make ajax requests from standalone javascript application?

Daniel Meyer

unread,
Dec 30, 2013, 4:10:14 AM12/30/13
to camunda-...@googlegroups.com
Hi Eldar,

Maybe you can implement this as custom Filter in a comparable way to which we implement the CacheControl filter:

You could than package your filter as a JAR file, add it to the WEB-INF/lib Folder of the engine-rest/ application and activate it in WEB-INF/web.xml File

WDYT?

Cheers,
Daniel Meyer

Eldar Aliyev

unread,
Jan 8, 2014, 1:01:07 AM1/8/14
to camunda-...@googlegroups.com
Hi, Daniel

Thank you for your responce. And sorry for late answer and newbie question :) But lastly I found out a working solution in standard Tomcat 7 distribution. There is a CORS filter and the point is that it's declaration must prepend any other filters in engine-rest web.xml config file.
I used the following options in my config and it seems working well enough:
    <filter>
     
<filter-name>CorsFilter</filter-name>
     
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
     
<init-param>
       
<param-name>cors.allowed.origins</param-name>
       
<param-value>*</param-value>
     
</init-param>
     
<init-param>
       
<param-name>cors.allowed.methods</param-name>
       
<param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
     
</init-param>
     
<init-param>    
           
<param-name>cors.allowed.headers</param-name>    
           
<param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization</param-value>    
       
</init-param>    
       
<init-param>    
           
<param-name>cors.exposed.headers</param-name>    
           
<param-value>Access-Control-Allow-Origin</param-value>      
       
</init-param>    
   
</filter>
   
<filter-mapping>
     
<filter-name>CorsFilter</filter-name>
     
<url-pattern>/*</url-pattern>
   
</filter-mapping>



Regards,
Eldar A.

понедельник, 30 декабря 2013 г., 14:10:14 UTC+5 пользователь Daniel Meyer написал:

Daniel Meyer

unread,
Jan 9, 2014, 5:32:59 AM1/9/14
to camunda-...@googlegroups.com
Hi Eldar,

There are no newbee questions :) Thanks for posting your solution here,
since this is quite a common usecase, I think it will be helpful to
other people as well!

Thanks,
Daniel Meyer

shiv...@gmail.com

unread,
Sep 24, 2015, 12:42:04 PM9/24/15
to camunda BPM users
Hi,

How to turn on Cross-Origin Resource Sharing (CORS) response headers to Camunda REST engine in default distribution packet (with jboss-as-7.2.0.Final) to be able to make ajax requests from standalone javascript application?

The above post is really helpful, but I need to enable CORS in jboss? We are not having an option of enabling filter in jboss configuration.

Reply all
Reply to author
Forward
0 new messages