J'essaie d'intégrer la version Pentaho 7.1 CE avec une application Angular et là je dois accéder au contexte de Pentaho. À des fins d'authentification ici, j'utilise une API basée sur les cookies et en passant le paramètre. Pendant ce temps, je reçois l'erreur suivante:CORS Erreur dans Pentaho 7.1 CE
XMLHttpRequest cannot load http://localhost:8083/pentaho/j_spring_security_check . Redirect from ' http://localhost:8083/pentaho/j_spring_security_check ' to ' http://localhost:8083/pentaho/Home;jsessionid=E0B8FFAFE57EDEC09DB8229457FAA7B4 ' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:4200 ' is therefore not allowed access.
Je permettent déjà CORS dans Pentaho et modifié le fichier web.xml
situé à pentaho-server\tomcat\conf
:
<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</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Allow-Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
</init-param>
<init-param>
<param-name>cors.exposed.headers</param-name>
<param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</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.preflight.maxage</param-name>
<param-value>10</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Quelqu'un peut-il me suggérer ce que je suis absent ici? Une idée de comment je peux résoudre ce problème?
@ Alaa ZainMerci pour votre réponse rapide. Alors vous devez installer le paquet de nuget dans le 4 angulaire s'il vous plaît me guider – sam140
vous devez installer d'abord Nuget4Code et l'utiliser pour installer le Microsoft.AspNet.WebApi.Cors dans votre projet –