Habilitar CORS en el paquete Tomcat

1
0
-1

Buenas,

Estoy siguiendo este apartado de la documentacion de bonita : https://documentation.bonitasoft.com/bonita/7.10/enable-cors-in-tomcat-b....

Modificico mi archivo tal con lo indicado en el enlace añadiendo el siguiente filtro el primero. Aun asi, no consigo que de muestren los datos de mi API REST alojada en el dominio <strong>localhost:4456</strong>

¿Porque puede estar fallando?



<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>https://localhost:4456</param-value>
  </init-param>

  <init-param>
        <param-name>cors.support.credentials</param-name>
        <param-value>true</param-value>
  </init-param>

  <init-param>
    <param-name>cors.allowed.methods</param-name>
   <param-value>GET, HEAD, POST, PUT, DELETE, OPTIONS</param-value>
  </init-param>

  <!-- List of the response headers other than simple response headers that the browser should expose to
    the author of the cross-domain request through the XMLHttpRequest.getResponseHeader() method.
    The CORS filter supplies this information through the Access-Control-Expose-Headers header. -->
  <init-param>
      <param-name>cors.exposed.headers</param-name>
      <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials,X-Bonita-API-Token</param-value>
  </init-param>

  <!-- The names of the supported author request headers. These are advertised through the Access-Control-Allow-Headers header.
    The CORS Filter implements this by simply echoing the requested value back to the browser.
  -->
  <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,X-Bonita-API-Token</param-value>
  </init-param>

</filter>


CorsFilter
/*

1 answer

1
0
-1

Hello,

Sorry to answer in English but my Spanish is not so good...
Just to be sure, did you also put the filter-mapping element as first filter mapping and made sure to remove the "..." of the configuration example ?
Do you get an error on startup or is everything working but CORS ?

HTH

Notifications