You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by prgtrdr <pr...@gmail.com> on 2013/10/10 14:23:27 UTC

Re: STOMP/Websockets and CORS

Just to confirm, I am able to do cross-domain requests to ActiveMQ against
the Jetty server.  If you pay close attention to the documentation you won't
go too far wrong but unfortunately, there are some incorrect instructions
for how to set it up on various web sites.  In general, the given samples
will not properly handle preflight requests.  Specifically, you will find
sample web.xml that looks like this:

<web-app>
 <filter>
   <filter-name>cross-origin</filter-name>
   <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
   <init-param>
       <param-name>allowedOrigins</param-name>
       <param-value>*</param-value>
   </init-param>
   <init-param>
       <param-name>allowedMethods</param-name>
       <param-value>*</param-value>
   </init-param>
   <init-param>
       <param-name>allowedHeaders</param-name>
       <param-value>*</param-value>
   </init-param>
 </filter>
 <filter-mapping>
     <filter-name>cross-origin</filter-name>
     <filter-pattern>/*</filter-pattern>
 </filter-mapping>
</web-app>

But to make it work it needs to look like this:

<web-app>
 <filter>
   <filter-name>cross-origin</filter-name>
   <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
   <init-param>
       <param-name>allowedOrigins</param-name>
       <param-value>*</param-value>
   </init-param>
   <init-param>
       <param-name>allowedMethods</param-name>
       <param-value>GET,PUT,HEAD,OPTIONS</param-value>
   </init-param>
   <init-param>
       <param-name>allowedHeaders</param-name>
       <param-value>*</param-value>
   </init-param>
 </filter>
 <filter-mapping>
     <filter-name>cross-origin</filter-name>
     <url-pattern>/*</url-pattern>
 </filter-mapping>
</web-app>



--
View this message in context: http://activemq.2283324.n4.nabble.com/STOMP-Websockets-and-CORS-tp4670067p4672528.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.