activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prgtrdr <prgt...@gmail.com>
Subject Re: STOMP/Websockets and CORS
Date Thu, 10 Oct 2013 12:23:27 GMT
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.

Mime
View raw message