I am getting the following CORS message:
Access to XMLHttpRequest at 'http://localhost:8080/ottoautomaatitv2/webservice?postitoimipaikka=mikkeli'
from origin 'http://localhost:4200' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
What I have done to try to fix the issue is to add a CORS filter, but that didn't solve the issue.
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
The only way I can get around the issue is by using Google Chrome with a --user-data-dir="C:/Chrome dev session" --disable-web-security
target, but this is not ideal for me. How do I enable Access-Control-Allow-Origin
on Apache Tomcat?